0

I'm learning Js. I have a problem in the code:

const express = require('express');
const app = express();

const PORT = 3000;

app.listen(PORT, function(){
    console.log("The Express is running");
});

app.get('/', (req,res)=>{
    res.send('Ok');
});

running node app.js i have the answer "Ok".But, running in the browser(localhost:3000) i get : "The connection was refused". necessary info: I'm use a container docker, which I use the ubuntu. Can this cause a problem?

G.M
  • 3
  • 1
  • https://docs.docker.com/config/containers/container-networking/#published-ports –  Sep 22 '20 at 20:36
  • Does this answer your question? [How do I assign a port mapping to an existing Docker container?](https://stackoverflow.com/questions/19335444/how-do-i-assign-a-port-mapping-to-an-existing-docker-container) – Krzysztof Krzeszewski Sep 22 '20 at 20:38
  • @Krzystof according to: [link] (https://stackoverflow.com/questions/19335444/how-do-i-assign-a-port-mapping-to-an-existing-docker-container) I have compromised my container for a new container, I did "docker run -p 3000: 3000 -td new", but the problem still continues. I've run in this new container and nothing. – G.M Sep 22 '20 at 21:40

0 Answers0