20 lines
481 B
JavaScript
20 lines
481 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 { id } = req.query;
|
||
|
let { username } = input;
|
||
|
let videos = await db.all('SELECT * FROM video WHERE username = ? ORDER BY date DESC', [
|
||
|
req.query.id
|
||
|
]);
|
||
|
return res.render('user', {
|
||
|
username,
|
||
|
id,
|
||
|
videos
|
||
|
});
|
||
|
});
|
||
|
|
||
|
export default main;
|