@panenco/papi / Exports
@panenco/papi is a superset on top of a few packages:
This general set of utilities helps you to build RESTful APIs with ease. It embraces a very opinionated approach by forcing a specific pattern. All endpoints using these utilities should follow the following steps:
- Authorize and validate requirements
- Validate and map input (body, query, params)
- Business logic in a handler
- Output representation with a specific schema defined in validation classes so no excessive data can be accidentally returned
4 Main categories of utilities:
A set of extended and combined decorators to make input validation and output representation easier and very consistent.
The full list of available decorators can be found in the technical documentation.
A general way of authorizing requests by first validating the token and then checking the authorization requirements specified in the route.
- Create an authenticator instance and pass it to routing-controllers
authorizationCheckerwith getAuthenticator- This will connect the
@Authorizedecorator
- This will connect the
- Apply