-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
48 lines (36 loc) · 930 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
41
42
43
44
45
46
47
48
import express from "express";
import sequelize from "./Database/config.js";
import {connectDB} from "./Database/config.js";
import allRoutes from "./Routes/allRoutes.js";
import init from "./Database/init.js";
import Session from "express-session";
import mysequelizeStore from "./Database/sessionconfig.js";
import cors from 'cors';
const app=express();
connectDB();
app.use(Session(
{
secret:"secret",
store: mysequelizeStore,
saveUninitialized: true,
resave: false,
proxy: false,
})
);
mysequelizeStore.sync({});
init();
app.use(express.json());
app.use('/',allRoutes);
const port=5000;
let corsOptions=cors({
origin:"http://localhost:5173"
})
app.use(corsOptions)
app.listen(port,(error)=>{
if(error)
return console.log("Server not started. "+error);
console.log("Server started at port "+port);
});
app.get('/getget',corsOptions,(req,res)=>
res.send("you got"));
;