chew/server/posts.js

10 lines
No EOL
303 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: { source: true }}))
})
export default app