forked from tejas0123/Carz4All
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
31 lines (27 loc) · 983 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
const express = require('express');
const bcrypt = require('bcrypt');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const cors = require('cors');
const app=express();
const adminRouter= require('./Router/admin');
const shopRouter= require('./Router/shop');
const bodyparser = require('body-parser');
const path = require('path');
app.set('view engine','ejs');
app.set('views','views');
app.use(cookieParser());
app.use(session({key:'user_sid',secret:"AuthenticationUsingNodeAndExpressJSForLoginandSignup", cookie: {expires:600000}, saveUninitialized:false, resave:false
}));
app.use(cors({
origin: ["http://localhost:3000"],
methods: ["GET", "POST"],
credentials:true
}));
app.use(bodyparser.urlencoded({extended : false}));
app.use(express.static(path.join(__dirname,'public')));
app.use('/admin',adminRouter);
app.use('/',shopRouter);
app.listen(3000,()=>{
console.log("Server started, listening on port 3000");
});