diff --git a/doc/README.md b/doc/README.md index 7956829..68bca97 100644 --- a/doc/README.md +++ b/doc/README.md @@ -38,4 +38,14 @@ or ![alt text](./assets/start_node_server2.png) -the second method uses the [nodemon.json](../nodemon.json) to configure nodemon. \ No newline at end of file +the second method uses the [nodemon.json](../nodemon.json) to configure nodemon. + +# .env file + +To have different behavior on your dev host, you cloud add an .env file. + +Here are the key-values of an .evc file: + +```bash +PORT = 3000 +``` \ No newline at end of file diff --git a/src/server.js b/src/server.js index 0e9c2ca..a25e58d 100644 --- a/src/server.js +++ b/src/server.js @@ -33,5 +33,6 @@ app.get('/', (req, res) => { res.render('index.ejs') }) -const port = process.env.PORT; +const port = process.env.PORT || 3000;; + app.listen(port, () => console.log("Server is running on http://localhost:%i", port)); \ No newline at end of file