bigly-chat/client/main.js
2024-11-25 14:12:44 -05:00

22 lines
No EOL
621 B
JavaScript

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 { username } = input;
let videos = await db.all('SELECT * FROM video ORDER BY date DESC LIMIT 20', [
]);
let videosFollow = await db.all('SELECT * FROM video WHERE username IN (SELECT target FROM follow WHERE username = ?) ORDER BY date DESC LIMIT 20', [
username
]);
res.render('main', {
...input,
videos,
videosFollow
});
return true;
});
export default main;