-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
40 lines (32 loc) · 971 Bytes
/
app.js
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
36
37
38
39
40
import express from "express";
import dotenv from "dotenv";
import cors from 'cors';
import cookieParser from "cookie-parser";
import fileUpload from "express-fileupload";
import userRouter from "./routes/userRouter.js";
import jobRouter from "./routes/jobRouter.js";
import appRouter from "./routes/appRouter.js";
import { dbConnection } from "./database/dbConnection.js";
import { errorMiddleware } from "./middlewares/error.js";
const app = express();
dotenv.config({ path: "./config/config.env" });
app.use(cors({
origin: [process.env.FRONTED_URL],
methods: ['GET', 'POST', 'DELETE', 'PUT'],
credentials: true
}));
app.use(cookieParser());
app.use(express.json());
app.use(express.urlencoded({
extended: true
}));
app.use(fileUpload({
useTempFiles: true,
tempFileDir: '/tmp/'
}));
app.use('/user', userRouter);
app.use('/job', jobRouter);
app.use('/application', appRouter);
dbConnection();
app.use(errorMiddleware)
export default app;