project-knedita/src/app.ts

25 lines
529 B
TypeScript
Raw Normal View History

2023-06-20 20:05:15 +00:00
import 'dotenv/config'
import express from 'express'
import router from './routes'
2023-06-20 20:05:15 +00:00
import compression from 'compression'
import limiter from './middlewares/rate-limit'
2023-06-20 20:05:15 +00:00
const app = express()
// TODO: Create a documentation page or create the client because this is getting really big
2023-06-20 20:05:15 +00:00
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
app.use(router)
app.use(limiter)
2023-06-20 20:05:15 +00:00
app.use(compression({ level: 9 }))
app.use((_req, res) => {
res.status(404).json({
error: 'Not found'
})
})
export default app