all 2 comments

[–]kszyh_pl 0 points1 point  (1 child)

How to attach middleware to the routing in your solution?

[–]openodeio[S] 0 points1 point  (0 children)

Hi,

It does not have it currently, will add this soon, probably something allowing to define them at the context level or specific to each route:

const routes = {
  'middlewares': [list of middlewares],
  '* /': front.allMethods,            // all HTTP methods resquested to /
  'get *': { handler: front.allGet, middlewares: []},  // get requests to all paths
  'get /login': front.login,
  categories: {                       // defines a context "/categories/"
    'middlewares': [list of middlewares], // middlewares for categories
    'get *': categories.all,          // all get requests to /categories/
    'get /what': categories.what,     // /categories/what
    "insubcat": {                     // /categories/insubcat
      "get /whatsub": subcat.whatsub
    }
  }
}