Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/JKHeadley/rest-hapi

🚀 A RESTful API generator for Node.js
https://github.com/JKHeadley/rest-hapi

api audit-log crud crud-api crud-generator documentation hapi hapi-plugin hapi-server joi joi-validation mongodb mongoose nosql relational rest rest-api swagger validation

Last synced: about 1 month ago
JSON representation

🚀 A RESTful API generator for Node.js

Awesome Lists containing this project

README

        

rest-hapi logo


rest-hapi title


A RESTful API generator
rest-hapi tweet




Github Actions


Codecov


npm


npm


StackShare


Join the chat at https://gitter.im/rest-hapi/Lobby

rest-hapi is a [hapi](https://hapijs.com/) plugin that generates RESTful API endpoints based on [mongoose](http://mongoosejs.com/) schemas. It provides a powerful combination of [relational](https://resthapi.com/docs/associations.html) structure with [NoSQL](https://resthapi.com/docs/creating-endpoints.html) 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](https://resthapi.com/docs/creating-endpoints.html) and [association](https://resthapi.com/docs/associations.html) endpoints with [middleware](https://resthapi.com/docs/middleware.html) support
* [joi](https://github.com/hapijs/joi) [validation](https://resthapi.com/docs/validation.html)
* Route-level and document-level [authorization](https://resthapi.com/docs/authorization.html)
* [Swagger docs](https://resthapi.com/docs/swagger-documentation.html) for all generated endpoints
* [Query parameter](https://resthapi.com/docs/querying.html) support for searching, sorting, filtering, pagination, and embedding of associated models
* Endpoint activity history through [Audit Logs](https://resthapi.com/docs/audit-logs.html)
* Support for [policies](https://resthapi.com/docs/policies.html) via [mrhorse](https://github.com/mark-bradshaw/mrhorse)
* [Duplicate fields](https://resthapi.com/docs/duplicate-fields.html)
* Support for ["soft" delete](https://resthapi.com/docs/soft-delete.html)
* Optional [metadata](https://resthapi.com/docs/metadata.html) for documents
* Mongoose [wrapper methods](https://resthapi.com/docs/mongoose-wrapper-methods.html)
* ...and more!

---
## Live demo

![rest-hapi-demo-optimized](https://user-images.githubusercontent.com/12631935/41813184-b31cac6a-76e5-11e8-84c3-881d98e6c65d.gif)

View the swagger docs for the live demo:

https://demo.resthapi.com

Or, for a more complete example, check out the [appy](https://appyapp.io) api:

https://api.appyapp.io

## Documentation

Check out the docs on the [official site](https://resthapi.com)!

## Requirements

You need [Node.js](https://nodejs.org/en/) installed and you'll need [MongoDB](https://docs.mongodb.com/manual/installation/) installed and running.

## Quick Start
![rest-hapi-demo-alt-optimized](https://user-images.githubusercontent.com/12631935/41813206-0d2298a0-76e6-11e8-95d4-9b1e521c179e.gif)

(**NOTE:** For an alternative quick start, check out his [awesome yeoman generator](https://github.com/vinaybedre/generator-resthapi) for rest-hapi.)

1) Clone the demo repo
```
$ git clone https://github.com/JKHeadley/rest-hapi-demo.git
$ cd rest-hapi-demo
```

2) Install the dependencies
```
$ npm install
```

3) Seed the models
```
$ ./node_modules/.bin/rest-hapi-cli seed
```

4) Start the server
```
$ npm start
```

5) View the API docs at

[http://localhost:8080/](http://localhost:8080/)

...have fun!

## Example Projects

[appy](https://github.com/JKHeadley/appy): A boilerplate web app.

[rest-hapi-demo](https://github.com/JKHeadley/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](https://resthapi.com/)
- Report bugs
- Follow us on [Twitter](https://twitter.com/resthapi)
- Participate in the [gitter community](https://gitter.im/rest-hapi/Lobby)
- And [donate financially](https://opencollective.com/rest-hapi)!

Please read our [contribution guide](CONTRIBUTING.md) to get started. Also note
that this project is released with a
[Contributor Code of Conduct](CODE_OF_CONDUCT.md), please make sure to review
and follow it.

## Contributors

Thanks goes to each one of our contributors! 🙏

[Become a contributor](CONTRIBUTING.md).

## Backers

Support us with a monthly donation and help us continue our activities!
[Become a backer](https://opencollective.com/rest-hapi#backers).

## Questions?
If you have any questions/issues/feature requests, please feel free to open an [issue](https://github.com/JKHeadley/rest-hapi/issues/new). We'd love to hear from you!

## Support
Like this project? Please star it!

## License
rest-hapi is licensed under a [MIT License](LICENSE).