-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathlogi.js
More file actions
23 lines (18 loc) · 731 Bytes
/
Copy pathlogi.js
File metadata and controls
23 lines (18 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict';
const port = 3000;
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const urlencoded = bodyParser.urlencoded;
const staticServer = express.static;
app.use(urlencoded({ extended: true }));
app.use('/', staticServer('./static/'));
app.post('/logi', function(req, res) {
// We trust our users, every login will be successful!
const username = req.body.username;
const password = req.body.password;
// Enterprise-grade logging FTW!
console.log(`${username} logged in with the password: ${password}.`);
res.end('Logged in with the honor system');
});
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`));