diff --git a/assignments/config-files/hackyourtemperature/postman_result.png b/assignments/config-files/hackyourtemperature/postman_result.png new file mode 100644 index 000000000..78f3fa949 Binary files /dev/null and b/assignments/config-files/hackyourtemperature/postman_result.png differ diff --git a/assignments/config-files/hackyourtemperature/server.js b/assignments/config-files/hackyourtemperature/server.js new file mode 100644 index 000000000..d7154a38a --- /dev/null +++ b/assignments/config-files/hackyourtemperature/server.js @@ -0,0 +1,15 @@ +import express from "express"; +const app = express(); +const PORT = 3000; +app.use(express.json()); + +app.get("/", (req, res) => { + res.send("Hello from the backend "); +}); +app.post("/weather", (req, res) => { + const { cityName } = req.body; + + res.json({ message: `Your city is : ${cityName} ` }); +}); + +app.listen(PORT, () => console.log(`listening on port ${PORT}!`)); diff --git a/package.json b/package.json new file mode 100644 index 000000000..da7e6cd93 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "dependencies": { + "express": "^4.21.2" + }, + "name": "node.js-cohort51", + "version": "1.0.0", + "description": "> If you are following the HackYourFuture curriculum we recommend you to start with module 1: [HTML/CSS/GIT](https://github.com/HackYourFuture/HTML-CSS). To get a complete overview of the HackYourFuture curriculum first, click [here](https://github.com/HackYourFuture/curriculum).", + "main": "index.js", + "type": "module", + + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "nodemon": "^3.1.9" + } +}