-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
27 lines (20 loc) · 650 Bytes
/
script.js
File metadata and controls
27 lines (20 loc) · 650 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
const express = require('express');
const app = express();
const port = process.env.PORT || 3000;
app.use(express.json());
app.use(express.urlencoded({extended: true}));
app.use(express.static('views'));
const emailDB = 'div@gmail.com';
const passwordDB = '123'
app.post('/login', (req, res) => {
// this email & password getting from name attribute in <form></form>
const {email, password} = req.body;
if(email == emailDB && password == passwordDB){
res.send('login success')
}else{
res.send('login fail')
}
})
app.listen(port, () => {
console.log(`Server running at http://localhost:${port}/`);
});