Open dalssoft opened 3 years ago
I think we need only specify the request, because in my request I will build my own logic to call my usecase:
const controllerList = [
{
name: 'lists',
idParameter: 'listId',
getAll: require('../usecases/getLists'),
getById: (req, res, next) => {
// [...] controller logic
const result = usecase.run()
res.json(result)
}
...
}
]
the issue is specific on how to deal with variable coming from query string, body and params.
that is the current implementation: https://github.com/herbsjs/herbs2rest/blob/885a83b4644c3e43efb9bad9d3ea5d0d39bcdbc6/src/helpers/req2request.js#L9
but overriding it should be possible.
Having a default request logic (how the
req
info is dealt for each type of route) is useful but forcing it is bad. There should be a way to override it for certain use cases.Suggested UX: