mirror of
https://github.com/Floriansylvain/CineAllo.git
synced 2026-08-19 11:43:24 +02:00
24 lines
480 B
JavaScript
24 lines
480 B
JavaScript
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})
|
|
})
|