destjs
destjs copied to clipboard
Context Helpers
The framework has to give developer helper functions to manage request context.
Some ideas:
- A function to set response status
- A decorator to set success HttpCode - by @yan-almeida
Well, writing this i realized that oak has a good structure and properties in context... The issue will be open until we get some other ideas
A good practice would be to adopt a decorator to configure the HTTP response.
Something like:
// where the StatusCode receives an enum of http-status
@HttpCode(StatusCode);
Use case:
// overrinding request status
@HttpCode(StatusCode.CREATED);
created (... args) {
return 'Creating something.'
}
We should return 201 - Created when we get a successful response while creating some resource.