3dub icon indicating copy to clipboard operation
3dub copied to clipboard

add DSL for configuring routes

Open MiguelCastillo opened this issue 6 years ago • 0 comments

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.

MiguelCastillo avatar Sep 15 '17 13:09 MiguelCastillo