-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
41 lines (32 loc) · 1.16 KB
/
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
41
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const helmet = require("helmet");
const passport = require("passport");
const userRoutes = require("./routes/users");
const jobRoutes = require("./routes/jobs");
const applicantRoutes = require("./routes/applicants");
const recruiterRoutes = require("./routes/recruiters");
const domainRoutes = require("./routes/domains");
const skillRoutes = require("./routes/skills");
const app = express();
app.use(helmet());
app.use(express.json());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }))
app.use(cors());
app.use(passport.initialize());
app.use(passport.session());
require("./config/passport")(passport);
app.use(function (err, req, res, next) {
console.error(err.stack);
if (!err.statusCode) err.statusCode = 500;
res.status(err.statusCode).send({ error: err.message });
});
app.use("/api/users", userRoutes);
app.use("/api/applicants", applicantRoutes);
app.use("/api/recruiters", recruiterRoutes);
app.use("/api/jobs", jobRoutes);
app.use("/api/domains", domainRoutes);
app.use("/api/skills", skillRoutes);
module.exports = app;