From 85458c05e45008d5b1574b836d4ba517c7e6f989 Mon Sep 17 00:00:00 2001 From: Modo <yashlaxman@gmail.com> Date: Wed, 25 Oct 2023 23:51:10 +0530 Subject: [PATCH] Remove dev folder --- devfolder/app.js | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 devfolder/app.js diff --git a/devfolder/app.js b/devfolder/app.js deleted file mode 100644 index c477089..0000000 --- a/devfolder/app.js +++ /dev/null @@ -1,40 +0,0 @@ -<<<<<<< HEAD -======= -const express = require('express'); -const bodyParser = require('body-parser'); -const jwt = require('jsonwebtoken'); // Import the jsonwebtoken library - -const app = express(); -const PORT = 5000; -const cors = require('cors'); - -const corsOptions = { - origin: 'http://127.0.0.1:5500', // Replace with your frontend's origin - methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', - credentials: true, - optionsSuccessStatus: 204, - }; - -app.use(cors(corsOptions)); - -app.use(bodyParser.json()); - -const secretKey = 'your-secret-key'; - -app.post('/api/auth', (req, res) => { - const { user_name, password } = req.body; - // Check the username and password (for demonstration purposes, accept any non-empty values) - if (user_name==="Yash" && password==="123") { - // Authentication successful, create a JWT token - const token = jwt.sign({ user_name }, secretKey, { expiresIn: '1h' }); // Token expires in 1 hour - res.json({ token }); - } else { - // Authentication failed - res.status(401).json({ error: 'Invalid username or password' }); - } -}); - -app.listen(PORT, () => { - console.log(`Server is running on port ${PORT}`); -}); ->>>>>>> b1b896f (Add api request changes)