Ability to create an adapter dynamically
See original GitHub issueThere are a lot of cases where users are not able to use laconia’s built-in adapters. For example when creating an API endpoint, users are unable to create PUT or PATCH endpoint with the built-in adapters as we only support the inputType of body
or params
at the moment i.e. PUT might require body and params.
The current adapter for params
is also forcing an object to be passed as an input, and sometimes destructuring just a single parameter feels quite unnatural. For example if a user is trying to get id
path parameter, it will look like:
const app = ({ id }) => {}
Sometimes I’d like to have complete control over the signature of my app, and if I would like my signature like the following, I won’t be able to use the current built-in adapter:
const app = (id) => {}
In Java world, this can be solved by using annotation, which may look like the following.
const app = (@PathVariable('id') id, @Body automaticallyParsedHttpBody, @PathVariable('foo') foo) => {}
As this is unsupported in JavaScript, how can we allow users to do this? Thoughts?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
Top GitHub Comments
@all-contributors please add @hugosenari for design
Looks good to me, only problem is with ‘mapping’, term is to broad.
Roots:
Suffixes:
IE.: