From 4bd809a28bb08e57e51ea20805d6de17da4f0b69 Mon Sep 17 00:00:00 2001 From: SURMACH SIARHEI Date: Wed, 11 Jan 2023 18:49:12 +0300 Subject: [PATCH 1/2] test --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index f139e0a..bd4fb1d 100644 --- a/src/index.js +++ b/src/index.js @@ -1,2 +1,6 @@ // index.js // This is the main entry point of our application +const express = require ('express'); +const app = express(); +app.get ('/', (req,res) => res.send ('Hello World')); +app.listen (4000, () => console.log ('Listening on port 4000!')); \ No newline at end of file From 6b248f8b9a05f6878e93b778d34ccf6ab1468ac6 Mon Sep 17 00:00:00 2001 From: SURMACH SIARHEI Date: Wed, 11 Jan 2023 19:53:13 +0300 Subject: [PATCH 2/2] express --- package.json | 1 + src/index.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 219f23b..8da7433 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "API code examples for JavaScript Everywhere by Adam Scott, published by O'Reilly Media", "main": "src/index.js", "scripts": { + "server": "nodemon index.js", "start": "nodemon src/index.js", "dev": "nodemon src/index.js", "final": "nodemon final/index.js", diff --git a/src/index.js b/src/index.js index bd4fb1d..8506f17 100644 --- a/src/index.js +++ b/src/index.js @@ -2,5 +2,7 @@ // This is the main entry point of our application const express = require ('express'); const app = express(); -app.get ('/', (req,res) => res.send ('Hello World')); -app.listen (4000, () => console.log ('Listening on port 4000!')); \ No newline at end of file +const port = process.env.PORT || 4000; +app.get ('/', (req,res) => res.send ('Hello nice Server!!!')); +app.listen (port, () => +console.log (`Server running at http:// localhost: ${port}`)); \ No newline at end of file