New basket table, add empty state on basket page, new BasketItemModel

This commit is contained in:
2024-09-09 19:47:46 +02:00
parent dff6992db3
commit 40586f18b2
14 changed files with 190 additions and 68 deletions

View File

@@ -3,10 +3,17 @@ import { Product } from "../models/product.model";
export const product = Router()
product.get("/", (req: Request, res: Response, next: NextFunction)=> {
product.get("/", (req: Request, res: Response, next: NextFunction) => {
Product.findAll()
.then(products => {
res.json(products)
})
.catch(next)
})
product.get("/:productId", (req: Request, res: Response, next: NextFunction) => {
Product.findByPk(req.params.productId)
.then(product => {
res.json(product)
})
})