-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
40 lines (35 loc) · 1.06 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
import express from "express";
import mongoose from "mongoose";
import cors from "cors";
import session from "express-session";
import UsersController from "./users/users-controller.js";
import ReviewsController from "./reviews/reviews-controller.js";
import bookmarkController from "./bookmarks/bookmark-controller.js";
import SessionController from "./users/session-controller.js";
mongoose.connect(
"mongodb+srv://sylviawing96:[email protected]/viewvibe?retryWrites=true&w=majority"
);
const app = express();
app.use(
cors({
credentials: true,
// origin: "http://localhost:3000",
origin: "https://quiet-valkyrie-7c0418.netlify.app"
})
);
app.enable('trust proxy');
app.use(
session({
secret: "should be environment variable!",
resave: false,
saveUninitialized: true,
cookie: { secure: true, sameSite: 'none' }
// cookie: { secure: false},
})
);
app.use(express.json());
UsersController(app);
ReviewsController(app);
bookmarkController(app);
SessionController(app);
app.listen(process.env.PORT || 4000);