Move sku route to right place.
This commit is contained in:
22
src/routes/frontend/:id.ts
Normal file
22
src/routes/frontend/:id.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { Request, Response } from 'express';
|
||||
import { prisma, __path } from '../../index.js';
|
||||
import * as Eta from 'eta';
|
||||
|
||||
export default (req: Request, res: Response) => {
|
||||
// retrieve data from database using id from url
|
||||
prisma.item
|
||||
.findFirst({
|
||||
where: {
|
||||
SKU: req.params.id
|
||||
}
|
||||
})
|
||||
.then((item) => {
|
||||
if (item) {
|
||||
Eta.renderFile(__path + '/src/frontend/publicInfoPage.eta.html', item).then((html) => {
|
||||
res.send(html);
|
||||
});
|
||||
} else {
|
||||
res.send('Item not found');
|
||||
}
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user