This project is a template for creating Express APIs. It is structured to facilitate the development of scalable and maintainable applications.
The project is organized as follows:
src/: Contains the main server code, utility functions, and middleware.middlewares/: Contains middleware functions for logging and request validation.utils/: Contains utility functions for database connection and other operations.server.js: The main server file.
development/: Contains Dockerfile and shell script for setting up the development environment.package.json: Contains the list of project dependencies and scripts.Makefile: Contains commands for initializing the development environment and building the production image..envandsample.env: Environment configuration files..dockerignoreand.gitignore: Files specifying what to ignore when building Docker images and committing to Git respectively.
- Clone the repository.
- Rename the
sample.envto.envand customize the.envfile with your environment variables. - Install the dependencies by running
npm install. - Start the development server by running
npm run dev. - Build the production Docker image by running the commands specified in the
Makefile, runmake helpto see list of commands and descriptions.
This template is designed to be flexible and adaptable to various use cases. Feel free to modify and extend it to suit your needs.