Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

ashutoshgngwr/node-rest-api-boilerplate

Repository files navigation

node-rest-api-boilerplate

A boilerplate to quickly start building REST APIs in NodeJS without writing (too much) boilerplate code. HTTP Routes are auto-generated based on API definition (written in OpenAPI Specification).

Framework Stack

Environment Variables

  • DB_URI: MongoDB URI

Project Structure

  • api/oas.yml is the source of truth (definition) of the REST API.
  • src/app.js contains the boilerplate code to connect MongoDB client and to register fastify-openapi-glue middleware with proper configuration.
  • src/service.js would contain implementations of all the operations defined in API definition (omitted in this boilerplate).
  • src/tests contains cases to automate API testing.
  • index.js contains the boilerplate code to start Fastify server at port 8080.

License

MIT