forked from meetcshah19/cr3sc3ndo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (30 loc) · 928 Bytes
/
index.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
import express from "express";
import session from "express-session";
import cors from "cors";
import path from "path";
import cookieParser from "cookie-parser";
import bodyParser from "body-parser";
import router from "./routes/router.js";
global.__basedir = process.cwd();
global.__baseURL = "http://23.101.172.131:6900";
const app = express();
const port = 6900;
var corsOptions = {
origin: "*",
};
app.use(
session({
secret: "1@#@#%FHGKL@#hdsfg9*6", // just a long random string
resave: false,
saveUninitialized: true,
})
);
app.use(cors(corsOptions));
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.json());
// Routes
app.use(router);
app.use("/uploads", express.static(path.join(__basedir, "uploads")));
app.use("/images", express.static(path.join(__basedir, "images")));
app.listen(port, () => console.log("Listening on port 6900!"));