-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.ts
35 lines (28 loc) · 822 Bytes
/
server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import express from "express"
import { PrismaClient } from "@prisma/client"
import { UserModule } from "./.test/user"
import { ProjectModule } from "./modules/project"
import { RouteModule } from "./modules/routes"
import rateLimit from 'express-rate-limit'
const app = express()
const prisma = new PrismaClient()
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // Limit each IP to 50 requests per `window` (here, per 15 minutes)
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
})
app.use(limiter)
app.use(
express.json({
limit: "3mb",
})
)
app.get("/", (_, res) => {
res.send("Hello World!")
})
UserModule(app)
ProjectModule(app)
RouteModule(app)
export { app }
export { prisma }