blob: fef19775778bb0ae39ddeca3119086dd7409fd6e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import express from 'express';
import cors from 'cors';
import { PrismaClient } from '@prisma/client';
const app = express();
const port = 5000;
app.use(cors());
app.use(express.json());
const prisma = new PrismaClient();
app.get('/api/users', async (req, res) => {
const users = await prisma.user.findMany();
res.json(users);
});
app.listen(port, () => {
console.log(`Server listening on port ${port}`);
});
|