JKHeadley/rest-hapi
A RESTful API generator for Node.js
repo name | JKHeadley/rest-hapi |
repo link | https://github.com/JKHeadley/rest-hapi |
homepage | https://resthapi.com |
language | JavaScript |
size (curr.) | 6236 kB |
stars (curr.) | 997 |
created | 2016-10-30 |
license | MIT License |
rest-hapi is a hapi plugin that generates RESTful API endpoints based on mongoose schemas. It provides a powerful combination of relational structure with NoSQL flexibility. You define your data models and the rest is done for you. Have your API up and running in minutes!
Features
- Automatic generation of CRUD and association endpoints with middleware support
- joi validation
- Route-level and document-level authorization
- Swagger docs for all generated endpoints
- Query parameter support for searching, sorting, filtering, pagination, and embedding of associated models
- Endpoint activity history through Audit Logs
- Support for policies via mrhorse
- Duplicate fields
- Support for “soft” delete
- Optional metadata for documents
- Mongoose wrapper methods
- …and more!
Live demo
View the swagger docs for the live demo:
Or, for a more complete example, check out the appy api:
Documentation
Check out the docs on the official site!
Requirements
You need Node.js installed and you’ll need MongoDB installed and running.
Quick Start
(NOTE: For an alternative quick start, check out his awesome yeoman generator for rest-hapi.)
- Clone the demo repo
$ git clone https://github.com/JKHeadley/rest-hapi-demo.git
$ cd rest-hapi-demo
- Install the dependencies
$ npm install
- Seed the models
$ ./node_modules/.bin/rest-hapi-cli seed
- Start the server
$ npm start
- View the API docs at
…have fun!
Example Projects
appy: A boilerplate web app.
rest-hapi-demo: A simple demo project implementing rest-hapi in a hapi server.
Contributing
We welcome contributions to rest-hapi! These are the many ways you can help:
- Submit patches and features
- Improve the documentation and website
- Report bugs
- Follow us on Twitter
- Participate in the gitter community
- And donate financially!
Please read our contribution guide to get started. Also note that this project is released with a Contributor Code of Conduct, please make sure to review and follow it.
Contributors
Thanks goes to each one of our contributors! 🙏
Backers
Support us with a monthly donation and help us continue our activities! Become a backer.
Questions?
If you have any questions/issues/feature requests, please feel free to open an issue. We’d love to hear from you!
Support
Like this project? Please star it!
License
rest-hapi is licensed under a MIT License.