2023-05-04 20:21:10 +02:00
|
|
|
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
|
2023-05-12 23:57:21 +02:00
|
|
|
res.render(__path + '/src/frontend/items.eta.html', { items: items });
|
2023-05-04 20:21:10 +02:00
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.error(err);
|
|
|
|
res.status(500).render(__path + '/src/frontend/errors/dbError.eta.html', { error: err });
|
|
|
|
});
|
|
|
|
};
|