3dub
3dub copied to clipboard
add DSL for configuring routes
Adding the ability to configure routes and mapping them to modules that handle them would be fantastic. Example:
{
"routes": {
"/hello/world": "./helloWorldController",
"/hello/next": (req, res, next) => { next() },
"/hello/promise": (req, res) => { return Promise.resolve(); }
}
}
The example above will load ./helloWorldController
, which is expected to be a function, and will be configured as the route handle for /hello/world
. You can alternatively map the route to an actual function.