robin*

미사용 코드 정리

...@@ -3,7 +3,8 @@ const db = require('../db'); ...@@ -3,7 +3,8 @@ const db = require('../db');
3 3
4 app.get('/', async(req, res) => { 4 app.get('/', async(req, res) => {
5 res.render('boardlist', {boards: await db.get('board').find()}); 5 res.render('boardlist', {boards: await db.get('board').find()});
6 -}) 6 +});
7 +
7 app.get('/board/:bid', async(req, res) => { 8 app.get('/board/:bid', async(req, res) => {
8 let board = await db.get('board').findOne({name: req.params.bid}); 9 let board = await db.get('board').findOne({name: req.params.bid});
9 if(!board) { 10 if(!board) {
...@@ -12,7 +13,6 @@ app.get('/board/:bid', async(req, res) => { ...@@ -12,7 +13,6 @@ app.get('/board/:bid', async(req, res) => {
12 let threads = await db.get('thread').find({board: board._id}, {sort: '-lastUpdated', limit: 50}); 13 let threads = await db.get('thread').find({board: board._id}, {sort: '-lastUpdated', limit: 50});
13 res.render('threadslist', {board, threads}); 14 res.render('threadslist', {board, threads});
14 }); 15 });
15 -
16 app.post('/board/:bid', async(req, res) => { 16 app.post('/board/:bid', async(req, res) => {
17 if(!req.body.title || !req.body.content) { 17 if(!req.body.title || !req.body.content) {
18 res.status(400).send('제목이나 내용을 써주세요.'); 18 res.status(400).send('제목이나 내용을 써주세요.');
...@@ -25,11 +25,3 @@ app.post('/board/:bid', async(req, res) => { ...@@ -25,11 +25,3 @@ app.post('/board/:bid', async(req, res) => {
25 let thread = await db.get('thread').insert({board: board._id, title: req.body.title, content: req.body.content, lastUpdated: Date.now(), count: 1}); 25 let thread = await db.get('thread').insert({board: board._id, title: req.body.title, content: req.body.content, lastUpdated: Date.now(), count: 1});
26 res.redirect('/thread/' + thread._id); 26 res.redirect('/thread/' + thread._id);
27 }); 27 });
28 -
29 -app.get('/borad/:bid/thread/:tid', async(req, res) => {
30 - let thread = await db.get('thread').findOne(req.params.tid);
31 - if(!thread) {
32 - res.status(404).json({error: 'Thread not found'});
33 - }
34 - res.json(thread);
35 -});
...\ No newline at end of file ...\ No newline at end of file
......