solidjs / solid-router

A universal router for Solid inspired by Ember and React Router
MIT License
1.14k stars 146 forks source link

feat: expose params on event for use in middlware #339

Closed brenelz closed 9 months ago

brenelz commented 9 months ago

This would allow you access to url params in the middeware. Saw someone ask for it and figured this out.

export default createMiddleware({
    onBeforeResponse: [
        event => {
            console.log(event.context.params?.id);
        },
    ]
});
ryansolid commented 9 months ago

Interesting. Although it would only be available after rendering. That being said .context is an H3 thing. We need to thing about where this goes.. standardizing it etc.

brenelz commented 9 months ago

Sounds good I can close this for now. It was just an idea