2024-09-07 18:12:58 -04:00
|
|
|
import Route from "../route.js";
|
2024-09-08 05:04:57 -04:00
|
|
|
import auth from "../form/auth.js";
|
2024-09-19 05:58:01 -04:00
|
|
|
import initDb from "../db.js";
|
|
|
|
|
|
|
|
let db = await initDb();
|
2024-09-07 18:12:58 -04:00
|
|
|
|
2024-09-08 05:04:57 -04:00
|
|
|
let main = new Route([auth], async function (req, res, input) {
|
|
|
|
let { username } = input;
|
2024-09-22 10:49:47 -04:00
|
|
|
let videos = await db.all('SELECT * FROM video ORDER BY date DESC LIMIT 10', [
|
2024-09-19 05:58:01 -04:00
|
|
|
]);
|
2024-09-18 18:47:09 -04:00
|
|
|
return res.render('main', {
|
2024-09-19 05:58:01 -04:00
|
|
|
username,
|
|
|
|
videos
|
2024-09-18 18:47:09 -04:00
|
|
|
});
|
2024-09-07 18:12:58 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
export default main;
|