rest-io
supports adding custom actions on resources.
To create a Custom Resource you extend the Resource class:
import { Resource } from 'rest-io';
export default class BananaResource extends Resource {
...
}
Now you can overwrite the standard calls:
export default class BananaResource extends Resource {
getAll(req, res) {
res.status(200).send('awesome!');
}
}
These are the functions you can overwrite or use:
This is the callback of the express route handler.
This is the callback of the express route handler.
This is the callback of the express route handler.
This is the callback of the express route handler.
This is the callback of the express route handler.
The error that is triggered and the express res
object to handle the result.
Make use of this.router
to setup new routes.