I am creating a nodejs/express app with typescript. I have installed the winston package. using
npm install winston.
I am following this article. i want to dockerize this.
What i have done so far:
- I have imported the winston package in the logger.ts.
- import the logger.js file to the server.ts file.
Winston logger works when I run
npm run dev command. I see the winston logs in the console.
When i implement the same in docker container.
docker build -t docker-image . command then
FROM node:10 WORKDIR /app COPY package*.json ./ RUN npm install # Bundle app source COPY . /app EXPOSE 5000 CMD [ "node", "dist/server.js" ]
version: '3' services: app: container_name: hoptik-pims-node restart: always build: . ports: - '5000:5000' links: - mongo mongo: container_name: mongo image: mongo ports: - '2717:27017'
I try to access the page http://localhost:5000/logger. I get Cannot GET /logger.
I do not understand what I am doing wrong. I have spent last couple of days trying fix this issue. Can someone help me fix this.
Thanks in advance.
Source: Docker Questions