From 25a3c47aa49214e9fe3831ebbfc025b4f58d9790 Mon Sep 17 00:00:00 2001 From: Irene Date: Sun, 27 Oct 2019 16:43:49 +0100 Subject: [PATCH] Dockerize api --- docker-compose.yml | 17 ++++++++++++++++- src/constants/pokeApi.constants.ts | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b951bcd..a40d786 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,22 @@ version: "3.1" services: - db: + api: + container_name: api + image: node:11 + restart: always + volumes: + - ./src:/var/www/src + - ./node_modules:/var/www/node_modules + - ./package.json:/var/www/package.json + - ./nodemon.json:/var/www/nodemon.json + - ./tsconfig.json:/var/www/tsconfig.json + build: . + ports: + - 8080:8080 + depends_on: + - mongo + mongo: container_name: mongoDB image: mongo:latest restart: always diff --git a/src/constants/pokeApi.constants.ts b/src/constants/pokeApi.constants.ts index cae8e51..03900a5 100644 --- a/src/constants/pokeApi.constants.ts +++ b/src/constants/pokeApi.constants.ts @@ -1,3 +1,3 @@ -export const PORT = 9001; +export const PORT = 8080; export const WELCOME_MESSAGE = "Welcome to pokeAPI REST by Nya ^^"; -export const MONGO_URL = "mongodb://localhost:27017/Pokemon"; +export const MONGO_URL = "mongodb://mongo:27017/Pokemon";