-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
32 lines (20 loc) · 859 Bytes
/
server.js
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
const express = require('express');
const app = express();
const PORT = process.env.PORT || 80;
const assemble = require('./src/assemble');
// static file serving
app.use(express.static(__dirname + '/public'));
// request body를 사용하려면 필요하다고 한다.
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.listen(PORT, () => {
console.log(`${PORT} 포트에서 서버 실행 중...`);
})
app.get('/', (req, res) =>{
res.send(assemble(require('./view/index')(),require('./style/md_css')(),null));
})
app.post('/write_item/:board_id', require('./src/write_item'));
app.get('/delete_item/:board_id/:id', require('./src/delete_item'));
app.get('/get_last/:board_id', require('./src/get_last'));
app.post('/new_board', require('./src/create_board'));
app.get('/:board_id', require('./src/read_board'));