-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
32 lines (26 loc) · 886 Bytes
/
server.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
const express = require("express")
require("dotenv").config()
const cookieParser = require("cookie-parser")
const helmet = require("helmet")
const cors = require("cors")
const session = require("express-session")
// const usersRouter = require("./users/users-router")
const server = express()
server.use(helmet())
server.use(cors())
server.use(express.json())
server.use(cookieParser())
// remove this when adding cookie parser
// server.use(session({
// resave: false, // avoid recreating sessions that have not changed
// saveUninitialized: false, // comply with GDPR laws for setting cookies automatically
// secret: "keep it secret, keep it safe", // cryptographically sign the cookie
// }))
// server.use("/api", usersRouter)
server.use((err, req, res, next) => {
console.log(err)
res.status(500).json({
message: "Something went wrong",
})
})
module.exports = server