Overview:
The Express ES2017 REST API Boilerplate is a boilerplate/generator/starter project designed for building RESTful APIs and microservices using Node.js, Express, and MongoDB. It is a feature-rich solution that enables developers to quickly set up a project with all the necessary tools and libraries.
Features:
- No transpilers, just vanilla javascript: The boilerplate allows developers to write code in plain JavaScript without the need for transpilers, making it easier to understand and debug.
- ES2017 latest features like Async/Await: The project utilizes the latest ECMAScript 2017 (ES2017) features, such as Async/Await, which simplifies writing asynchronous code.
- CORS enabled: Cross-Origin Resource Sharing (CORS) is enabled in the boilerplate, allowing clients from different origins to access the API resources securely.
- Uses yarn: Yarn is used as the package manager for managing dependencies and provides faster and more reliable package installation.
- Express + MongoDB (Mongoose): The boilerplate integrates Express.js, a popular web framework for Node.js, with MongoDB using Mongoose, providing a robust and scalable backend solution.
- Consistent coding styles with editorconfig: The project follows a consistent coding style across the codebase, enforced through an editorconfig file, ensuring code readability and maintainability.
- Docker support: Docker is supported in the boilerplate, allowing developers to containerize their applications and easily deploy them in different environments.
- Uses helmet to set some HTTP headers for security: The project utilizes helmet, a middleware for Express.js, to set various security-related HTTP headers, enhancing the overall security of the API.
- Load environment variables from .env files with dotenv: Environment variables can be easily loaded from .env files using the dotenv package, making it convenient to manage configuration settings.
- Request validation with joi: The boilerplate provides request validation capabilities using joi, a powerful data validation library.
- Gzip compression with compression: Efficient Gzip compression is implemented in the project using the compression middleware, reducing the size of the server's responses and improving performance.
- Linting with eslint: The code is automatically linted using the eslint tool, enforcing consistent code style and catching potential errors or bugs.
- Tests with mocha, chai, and sinon: Unit tests are set up in the boilerplate using mocha as the test runner, chai as the assertion library, and sinon for stubbing and mocking.
- Code coverage with istanbul and coveralls: Code coverage reports are generated using istanbul and can be integrated with Coveralls, providing insights into the quality and completeness of the tests.
- Git hooks with husky: Git hooks are configured using husky, allowing developers to execute custom scripts or enforce certain rules before committing or pushing code changes.
- Logging with morgan: The project uses the morgan logger middleware to log HTTP requests and responses, facilitating debugging and troubleshooting.