- Added basics GET routes for shows

This commit is contained in:
Florian Sylvain
2022-11-10 12:10:28 +01:00
parent 48005aaee2
commit 6e7d8b0801
4 changed files with 28 additions and 28 deletions
+23
View File
@@ -0,0 +1,23 @@
import express from 'express'
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
export const showsRouter = express.Router()
showsRouter.get('/', async function(req, res, next) {
const articles = await prisma.serie.findMany()
res.send({articles})
})
showsRouter.get('/:id', async function(req, res, next) {
const articles = await prisma.serie.findMany({
where: {
title: {
contains: req.params.id
}
}
})
res.send({articles})
})