Skip to content

neko-router add a way to validate request for a router #146

@devbro1

Description

@devbro1

why:
to allow request.header to contribute to route resolution

how:
add router.precondition((req: Request) => boolean). if returned false then this router will not be used for route resolution at all

another approach may be
router.addRoute((req,res) => {
if(req.header.version == 'v1') return routerV1;

return routerV2;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions