채지성

first

1 +// server.js
2 +
3 +const express = require('express');
4 +const app = express();
5 +
6 +const bodyParser = require('body-parser');
7 +app.use(bodyParser.urlencoded({extended : true}));
8 +
9 +app.listen(8080, function () {
10 + console.log('listening on 8080')
11 +})
12 +
13 +app.get('/', function(req, res){
14 + res.sendFile(__dirname + '/static/index.html')
15 +})
16 +
17 +app.post('/post', function(req, res){
18 + console.log(req);
19 +});
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html>
3 +<head>
4 + <meta charset="UTF-8">
5 +</head>
6 +<body>
7 + <form action="/post" method="post" name="ti">
8 + <input type="text">
9 + <button type="submit">submit</button>
10 + </form>
11 + <div></div>
12 +</body>
13 +</html>
...\ No newline at end of file ...\ No newline at end of file