bigly-chat/client/user.js

30 lines
No EOL
707 B
JavaScript

import Route from "../route.js";
import comment from "./comment.js";
import initDb from "../db.js";
let db = await initDb();
let main = new Route([comment], async function (req, res, input) {
let { id } = req.query;
let videos = await db.all('SELECT * FROM video WHERE username = ? ORDER BY date DESC', [
req.query.id
]);
let followers = await db.all('SELECT * FROM follow WHERE target = ?', [
req.query.id
]);
let following = await db.all('SELECT * FROM follow WHERE username = ?', [
req.query.id
]);
return res.render('user', {
...input,
id,
videos,
followers,
following
});
});
export default main;