senecajs / seneca-web

Http route mapping for Seneca microservices.
MIT License
76 stars 44 forks source link

postfix and prefix should be overridable at the route level #156

Closed tswaters closed 1 year ago

tswaters commented 1 year ago

Right now we only take post/prefix on the routeSet -- this should really allow it to be set at the mapping level as well.

e.g.,

{
  "prefix": "/api/things",
  "pin": "role:store,cmd:*",
  "map": {
    "view": {
      "GET": true,
      "postfix": "/:id"
    }
  }
}

This should result in a /api/things/view/:id route being added to the web service.

Need some better handling here: https://github.com/senecajs/seneca-web/blob/master/lib/mapper.js#L42-L43

e.g.,

prefix: routeSet.prefix ?? value.prefix,
postfix: routeSet.postfix ?? value.postfix,
tswaters commented 1 year ago

Actually, suffix does this, closing this ticket.