chew/server/posts.js
2022-02-14 13:06:33 +01:00

10 lines
No EOL
315 B
JavaScript

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
import express from 'express'
const app = express.Router()
app.get('/', async (req, res) => {
res.json(await prisma.post.findMany({ take: 10, orderBy: { date: 'desc' }, include: { tags: true, source: true }}))
})
export default app