build REST APIs faster than ever using the open source tools and standards you and your team already know.
hiroki is an open source tool inspired by baucis.
hiroki is fully compatible with mongoose 4 and 5.
hiroki is written in ES6 standards.
read the documentation here.
To install:
npm install --save hiroki
Create simple rest api:
const express = require('express');
const hiroki = require('hiroki');
const app = express();
const UsersSchema = new mongoose.Schema({name: String});
mongoose.model('Users', UsersSchema);
hiroki.rest('Users');//enable GET,PUT,POST & DELETE methods
app.use(hiroki.build());//automatically use the route "/api"
app.listen(8012);
it is possible to change the route that hiroki uses
const config = {path:'/api/v1'};
app.use(hiroki.build(config));
- v0.1.1: Bugfix count with conditions error.
- v0.1.0:
- PUT request fire pre save hook in Mongoose Schema.
- PUT udpate by condition only update one document.
- findOneAndUpdate method removed from PUT request.
- v0.0.9: Add support for new conditions format.
ej: GET /api/users?conditions[active]=true
- v0.0.8: fix general request function affect all routes. This type of decorators affected all the routes.
...
controller.request((req,res,next) => {
res.status(401).json({});
})
now it only affects the route of that collection