Toggle navigation
Toggle navigation
This project
Loading...
Sign in
201side
/
floater
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
3
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
robin*
2020-12-09 20:50:32 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7455246b604ebba0ab984964189ebb9169a7c901
7455246b
1 parent
9fe47033
미사용 코드 정리
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
10 deletions
src/routes/board.js
src/routes/board.js
View file @
7455246
...
...
@@ -3,7 +3,8 @@ const db = require('../db');
app
.
get
(
'/'
,
async
(
req
,
res
)
=>
{
res
.
render
(
'boardlist'
,
{
boards
:
await
db
.
get
(
'board'
).
find
()});
})
});
app
.
get
(
'/board/:bid'
,
async
(
req
,
res
)
=>
{
let
board
=
await
db
.
get
(
'board'
).
findOne
({
name
:
req
.
params
.
bid
});
if
(
!
board
)
{
...
...
@@ -12,7 +13,6 @@ app.get('/board/:bid', async(req, res) => {
let
threads
=
await
db
.
get
(
'thread'
).
find
({
board
:
board
.
_id
},
{
sort
:
'-lastUpdated'
,
limit
:
50
});
res
.
render
(
'threadslist'
,
{
board
,
threads
});
});
app
.
post
(
'/board/:bid'
,
async
(
req
,
res
)
=>
{
if
(
!
req
.
body
.
title
||
!
req
.
body
.
content
)
{
res
.
status
(
400
).
send
(
'제목이나 내용을 써주세요.'
);
...
...
@@ -25,11 +25,3 @@ app.post('/board/:bid', async(req, res) => {
let
thread
=
await
db
.
get
(
'thread'
).
insert
({
board
:
board
.
_id
,
title
:
req
.
body
.
title
,
content
:
req
.
body
.
content
,
lastUpdated
:
Date
.
now
(),
count
:
1
});
res
.
redirect
(
'/thread/'
+
thread
.
_id
);
});
app
.
get
(
'/borad/:bid/thread/:tid'
,
async
(
req
,
res
)
=>
{
let
thread
=
await
db
.
get
(
'thread'
).
findOne
(
req
.
params
.
tid
);
if
(
!
thread
)
{
res
.
status
(
404
).
json
({
error
:
'Thread not found'
});
}
res
.
json
(
thread
);
});
\ No newline at end of file
...
...
Please
register
or
login
to post a comment