A modern hapi REST service with automatic documentation using swagger with optional docker support
First, install Yeoman and generator-hapi-swagger-es6 using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-hapi-swagger-es6
Then generate your new project:
yo hapi-swagger-es6
This generator creates a hapi backend with the following features:
- Lab for testing
- Swagger for automatic endpoint documentation
- Console output by Good (good-squeeze and good-console)
- Two example endpoints (version and healtcheck)
- Testing examples including the main server and the two endpoints
- A Dockerfile and a docker-compose files for deploying as a microservice (optional)
- npm scripts for starting the server, starting on dev-mode with hot reloading (thanks to nodemon)
The generated code expects a node version >=6
because it makes a heavy use of destructuring.
We target cleaniness, simple folder structure and folowing hapi guidelines.
- Yeoman has a heart of gold.
- Yeoman is a person with feelings and opinions, but is very easy to work with.
- Yeoman can be too opinionated at times but is easily convinced not to be.
- Feel free to learn more about Yeoman.
MIT © Danielo Rodriguez Rivero