From 4af05af2d40baac1fbcf409e7efe77eaf8847468 Mon Sep 17 00:00:00 2001 From: Miguel-Cabral Date: Thu, 12 Jan 2023 11:39:33 +0000 Subject: [PATCH] save coursework week 1 --- server.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/server.js b/server.js index e69de29..afd4b35 100644 --- a/server.js +++ b/server.js @@ -0,0 +1,31 @@ +const trainees =[ + {name: "Miguel", region: "Manchester"}, + {name: "Sandra", region: "Manchester"}, + {name: "Zaw", region: "Manchester"}, + {name: "Dawood", region: "London"}, + {name: "Leila", region: "London"}, +]; + + + + +const { response } = require("express"); +const express = require("express"); +const app = express(); +const port = 9090; + +app.get("/", function (req, res){ + console.log("hello world"); + res.send("hello world are u getting a response") +}); + +app.get("/trainees", function(req, res){ + console.log(req.query.region, "...request.query.region"); + + console.log("received a request to the /trainees"); + res.send({trainees}); +}); + + app.listen(port, function(){ + console.log("my application is now working"); + }); \ No newline at end of file