Skip to content

Routes as middleware: fall-through logic #4

Description

@timoxley

It'd be neat to be able to trigger fall-through logic, middleware style.

e.g. attach a handler for /users/:userID that will validate :userID and or hydrate the user info which could be consumed in nested /users/:userID/* routes.

Express's params handler stuff is also kinda neat for centralising this kind of logic: http://expressjs.com/en/4x/api.html#app.param

Basically afaict just some way to toggle whether this is a return or a continue:

enroute/index.js

Lines 32 to 33 in 36300b8

if (typeof fn !== 'function') return fn
else return fn(params, props)

Just a thought.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions