Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
hapi-crud-promise
Advanced tools
Easily create CRUD routes on a hapi server by providing a path and promises for each of the actions
Reduce repetitive route setup for basic CRUD apps.
Provide one route and a 5 handlers:
/api/things/{thingId}
And get 5 routes added to your server:
GET /api/things
POST /api/things
GET /api/things/{thingId}
PUT /api/things/{thingId}
DELETE /api/things/{thingId}
const Hapi = require('hapi');
const Joi = require('joi');
const hapiCrudPromise = require('../index');
const server = new Hapi.Server();
server.connection({ host: '127.0.0.1' });
hapiCrudPromise(server, {
path: '/api/things/{thingId}',
config: {
validate: {
query: { // validation only applied to GET (all)
limit: Joi.number().optional()
}
params: { // validation only applied to GET (one), DELETE, and UPDATE routes
thingId: Joi.string().required()
},
payload: Joi.object({ // validation only applied to POST route
name: Joi.string().required()
})
}
},
crudRead(req) {
return /* a promise */
},
crudReadAll(req) {
return /* a promise */
},
crudUpdate(req) {
return /* a promise */
},
crudCreate(req) {
return /* a promise */
},
crudDelete(req) {
return /* a promise */
}
});
Contributors wanted. If you are looking for a way to help out browse the Help Wanted issues and find one that looks good to you. If you have an idea to make hap-crud-promise better submit a pull request.
Checklist for submitting a pull request:
npm run test
- Unit tests must passnpm run test-cov
- Code coverage cannot go downnpm run lint
- New code must have no linter errorsYeah, but with Promises! And active. And the Github repo is still live.
CRUD routes are repetitive. Write less code and go outside.
FAQs
Easily create CRUD routes on a hapi server by providing a path and promises for each of the actions
The npm package hapi-crud-promise receives a total of 15 weekly downloads. As such, hapi-crud-promise popularity was classified as not popular.
We found that hapi-crud-promise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.