aboutsummaryrefslogtreecommitdiff
path: root/src/routes/board.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/board.ts')
-rw-r--r--src/routes/board.ts21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/routes/board.ts b/src/routes/board.ts
index caa2d53..1a60b97 100644
--- a/src/routes/board.ts
+++ b/src/routes/board.ts
@@ -1,6 +1,6 @@
import express from 'express';
import type { Thread, Comment } from '../models/Thread';
-import { CreateBoard, CustomQuery, GetBoards } from '../database/postgres'
+import { CustomQuery, GetBoards, CreateBoard, GetBoard, CreateThread, GetThread, CreateComment } from '../database/postgres'
const router = express.Router();
@@ -23,22 +23,27 @@ router.post('/boards/:board', (req, res) => {
});
router.get('/board/:board', (req, res) => {
- res.status(404).send(req.params.board);
+ GetBoard(req.params.board, (r) => {
+ res.status(r.status).send(r.data);
+ });
});
router.post('/board/:board', (req, res) => {
- let t: Thread = req.body;
- console.log(t);
- res.status(403).send({board: req.params.board, thread: t});
+ CreateThread(req.params.board, req.body, (r) => {
+ res.status(r.status).send(r.data);
+ });
});
router.get('/board/:board/:tid', (req, res) => {
- res.status(404).send([req.params.board, req.params.tid]);
+ GetThread(req.params.board, req.params.tid, (r) => {
+ res.status(r.status).send(r.data);
+ });
});
router.post('/board/:board/:tid', (req, res) => {
- let c: Comment = req.body;
- res.status(404).send({params: [req.params.board, req.params.tid], body: c});
+ CreateComment(req.params.board, req.params.tid, req.body, (r) => {
+ res.status(r.status).send(r.data);
+ });
});
export default router;