-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp8.js
More file actions
25 lines (21 loc) · 806 Bytes
/
app8.js
File metadata and controls
25 lines (21 loc) · 806 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
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const static = require('serve-static');
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use('/', static(path.join(__dirname, 'public')));
app.use(function(req, res, next) {
const parmId = req.body.id || req.query.id;
const parmPassword = req.body.password || req.query.password;
res.send(`
<h1>서버에서 응답한 결과</h1>
<div><p>id: ${parmId}</p></div>
<div><p>password: ${parmPassword}</p></div>
<br><br><a href='/login1.html'>로그인 페이지로 돌아가기</a>
`);
});
app.listen(3000, function() {
console.log('http://localhost:3000');
});