hapi-crud-promise
Basics
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}
Simple Usage
const Hapi = ;const Joi = ;const hapiCrudPromise = ; const server = ;server; ;
Slightly-more-advanced Usage
If you have a long path in your route with multiple parameters the last one is special, it identifies the resource you are CRUD-ing and will only be included on validations for GET (one), DELETE, and UPDATE routes
const Hapi = ;const Joi = ;const hapiCrudPromise = ; const server = ;server; ;
Contributing
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 hapi-crud-promise better submit a pull request.
Pull Request Checklist
Checklist for submitting a pull request:
-
npm run test
- Unit tests must pass - New unit tests
-
npm run test-cov
- Code coverage cannot go down -
npm run lint
- New code must have no linter errors - Your pull request must pass CI
FAQ
hapi-crud?
Isn't this likeYeah, but with Promises! And active. And the Github repo is still live.
Can't I just create a bunch of routes manually?
CRUD routes are repetitive. Write less code and go outside.