Backend lol
This commit is contained in:
@ -7,8 +7,8 @@ import { queries } from "./inc/index";
|
||||
|
||||
const template = fs.readFileSync("./views/index.hbs", "utf-8");
|
||||
|
||||
router.get(/^\/$/, async (req, res) => {
|
||||
const db = await sql;
|
||||
router.get(/^\/(page\/[0-9]+)?$/, async (req, res) => {
|
||||
const db = await sql.getConnection();
|
||||
|
||||
try {
|
||||
const rows = await db.query(queries.items);
|
||||
@ -21,4 +21,5 @@ router.get(/^\/$/, async (req, res) => {
|
||||
.writeHead(500)
|
||||
.end(JSON.stringify(err), 'utf-8');
|
||||
}
|
||||
db.end();
|
||||
});
|
||||
|
Reference in New Issue
Block a user