Moved to new route structure.
This commit is contained in:
15
src/routes/frontend/items.ts
Normal file
15
src/routes/frontend/items.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import express, { Request, Response } from 'express';
|
||||
import { prisma, __path } from '../../index.js';
|
||||
|
||||
export default (req: Request, res: Response) => {
|
||||
prisma.item
|
||||
.findMany({})
|
||||
.then((items) => {
|
||||
// Count amount of total items
|
||||
res.render(__path + '/src/frontend/allItems.eta.html', { items: items });
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
res.status(500).render(__path + '/src/frontend/errors/dbError.eta.html', { error: err });
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user