/Nodejs-mongo-elasticsearch

https://www.thirdrocktechkno.com/blog/how-to-use-docker-and-docker-compose-with-nodejs-nodejs-mongodb-elasticsearch/

Primary LanguageJavaScript

Nodejs+MongoDB+ElasticSearch with Docker-compose

Demo Project for building RESTful APIs and microservices using Node.js, Express, MongoDB and Elasticsearch with docker-compose

PRs Welcome

Features

Requirements

Getting Started

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

Running Locally and Production

npm run start

Lint

# 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

Docker

# 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

Seeder

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