This is a base API using ExpressJs and NodeJs with docker deploy or PM2, easily and quickly.
- Sequelize and Mongoose paginate method
- Support to MongoDB Cluster
- Automatically connect to all databases
- Enabled or disabled databases
- Improved Docker or PM2 deploy
- New examples
- SSL independent
- Unprocessable Entity response (422)
- Fix bugs
.
├── Dockerfile
├── LICENSE
├── README.md
├── docker-compose.yml
├── package.json
├── pm2-deploy.yml
└── src
├── api
│ ├── artists
│ │ ├── _index.js
│ │ ├── _validates
│ │ │ ├── create.validate.js
│ │ │ └── update.validate.js
│ │ ├── create.js
│ │ ├── read.js
│ │ ├── readOne.js
│ │ └── update.js
│ └── musics
│ ├── _index.js
│ ├── _validates
│ │ ├── create.validate.js
│ │ └── update.validate.js
│ ├── create.js
│ ├── read.js
│ ├── readOne.js
│ └── update.js
├── app.js
├── config
│ ├── api.joi.conf.js
│ ├── env
│ │ ├── development.env.js
│ │ ├── production.env.js
│ │ └── test.env.js
│ └── sequelize.joi.conf.js
├── core
│ ├── Cors.js
│ ├── Database.js
│ ├── Paginate.js
│ ├── RequestQuery.js
│ ├── Response.js
│ ├── Routers.js
│ ├── SSL.js
│ └── Security.js
├── models
│ ├── mongodb
│ │ └── artists.js
│ ├── mysql
│ │ └── musics.js
│ └── postgres
│ ├── artists.js
│ └── musics.js
├── services
│ ├── Example.service.js
│ └── Service.js
├── storage
│ └── certificates
│ ├── ssl.crt
│ └── ssl.key
└── tests
└── api
└── example.test.js
# Clone the repo
git clone git@github.com:institutoprominas/microservices_base_api.git
cd microservices_base_api
# Remove .git
rm -rf .git
# Install packages
npm install
sudo npm install pm2 -g
# Build
npm run build
# Run (local)
npm run dev # (Development mode)
npm run test # (Run tests)
npm start # (Production mode with pm2, build before)
npm stop # (Stop Production)
npm restart # (Restart the api)
# Deploy (Docker)
npm run start-docker # (Pull image and deploy docker container)
npm run stop-docker # (Stop deployed container)
docker-compose # (Others deployment options)
# To install docker-compose
sudo apt install python python-pip
sudo pip install docker-compose