Demo Project for building RESTful APIs and microservices using Node.js, Express, MongoDB and Elasticsearch with docker-compose
-
CORS enabled
-
Express + MongoDB (Mongoose)
-
Consistent coding styles with editorconfig
-
Docker support
-
Load environment variables from .env files with dotenv
-
Linting with eslint
- Node v7.6+ or Docker
Clone the repo and make it yours:
git clone https://github.com/abhilashshettigar/express-mongo-elasticsearch-1.git
cd express-mongo-elasticsearch-1
Install dependencies:
npm i
Set environment variables:
cp .env.example .env
npm run start
# lint code with ESLint
npm run lint
# try to fix ESLint errors
npm run lint:fix
# lint and watch for changes
npm run lint:watch
# run container locally
npm run docker:start:dev
or
docker-compose -f docker-compose.dev.yml up
# run container in production
npm run docker:start:prod
or
docker-compose -f docker-compose.prod.yml up -d
# run tests
npm run docker:start:test
or
docker-compose -f docker-compose.test.yml up
Run seeder script: if you want to seed data locally you can use below command
npm run seed
Run seeder in docker
npm run docker:seed