From 57ee621648d7260e931d624f59b2a96be1548288 Mon Sep 17 00:00:00 2001 From: Mann Patel <130435633+MannPatel0@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:46:49 -0700 Subject: [PATCH] index and readme updated --- README.md | 2 +- server/index.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3b9ab93..5ce56cc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The ultimate plug for student deals 1. Add both node_modules from client and server to your `gitignore` file 2. Do not use `.ENV` variables 3. For any functionality make a brach with the prefix of your name `Name-` use this namign convention -4. For all method added a comment as to how, why, what it does +4. For all method added a comment as to what it does ## Client diff --git a/server/index.js b/server/index.js index 72b982c..a586274 100644 --- a/server/index.js +++ b/server/index.js @@ -3,12 +3,20 @@ import cors from "cors"; const app = express(); // Middleware +//uses the cors and json middleware +//cors is used to allow cross-origin requests +//json is used to parse the request body app.use(cors()); app.use(json()); // Sample Route +//This is a sample route that sends a JSON response +//when a GET request is made to /api/test app.get("/api/test", (req, res) => { res.json({ message: "Hello from server!" }); }); -app.listen(3030, () => console.log(`Server running on port ${3030}`)); +app.listen(3030, () => { + console.log("\tRunning Backend:"); + console.log("\x1b[36m \tLocal:\thttp://localhost:3030/ \x1b[0m"); +});