bigly-chat/client/comment.js

24 lines
506 B
JavaScript
Raw Normal View History

2024-09-22 03:49:36 -04:00
import Route from "../route.js";
import auth from "../form/auth.js";
import initDb from "../db.js";
let db = await initDb();
let main = new Route([auth], async function (req, res, input) {
let {route} = req.params;
let {id} = req.query;
2024-10-30 19:59:28 -04:00
let comments = await db.all('SELECT * FROM comment WHERE targetType = ? AND targetId = ? ORDER BY date DESC', [
2024-09-22 03:49:36 -04:00
route,
id
]);
return {
...input,
route,
id,
comments
};
});
export default main;