Skip to content

Commit a44f716

Browse files
committed
Add port and listen to server
1 parent 0b243da commit a44f716

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
},
55
"name": "module-decomposition",
66
"version": "1.0.0",
7+
"type": "module",
78
"description": "Exercises to practice and solidify your understanding of the Decomposition module of the Software Development Course.",
89
"main": "script.js",
910
"scripts": {
@@ -19,5 +20,6 @@
1920
"bugs": {
2021
"url": "https://github.com/RihannaP/Module-Decomposition/issues"
2122
},
22-
"homepage": "https://github.com/RihannaP/Module-Decomposition#readme"
23+
"homepage": "https://github.com/RihannaP/Module-Decomposition#readme",
24+
"devDependencies": {}
2325
}

script.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import express from "express"
22
const app = express();
3-
const port = 3000;
3+
4+
app.use(express.json());
5+
46

57
function usernameExtractor(req, res, next) {
68
const username = req.get("X-Username");
@@ -41,4 +43,9 @@ app.post("/", usernameExtractor,(req, res) => {
4143
}
4244

4345
res.send(response);
46+
});
47+
48+
const PORT = 3000;
49+
app.listen(PORT, () => {
50+
console.log(`Server running on http://localhost:${PORT}`);
4451
});

0 commit comments

Comments
 (0)