-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
38 lines (32 loc) · 841 Bytes
/
test.js
File metadata and controls
38 lines (32 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
End points:
Register
Login
posts - view every post so far
Profile - View your posts, How many people you follow, how many people follow you
*/
const express = require("express");
const mongoose = require("mongoose");
const jwt = require("jsonwebtoken");
mongoose.connect("mongodb+srv://rohitlal19022006:whoosh@blogger.rzfscbw.mongodb.net/rand");
const userSchema = mongoose.model('Users',{
username: String,
password: String
});
const app = express();
new userSchema({
username: "fahad",
password: "pass"
}).save();
app.use(express.json());
app.get("/login", async (req, res)=>{
const username = "fahad";
const password = "pass";
const found = await userSchema.findOne({
username : username
});
res.send(found.password)
});
app.listen(2501, ()=>{
console.log("APps running");
});