-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
32 lines (29 loc) · 999 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
const express = require('express');
const app = express();
const cookieparser = require('cookie-parser');
const session = require('express-session')
const path = require("path");
const db = require("./config/database-connection");
const productRoutes = require('./routes/productRoutes')
const userRoutes = require('./routes/userRoutes')
const ownerRoutes = require('./routes/ownerRoutes');
const indexRoutes = require('./routes/indexRoutes')
const flash = require('connect-flash');
require("dotenv").config();
app.use(express.json());
app.use(session(
{ resave: false,
saveUninitialized: true,
secret: process.env.EXPRESS_SESSION_SECRET_KEY,
}
))
app.use(express.urlencoded({extended:true}));
app.use(cookieparser());
app.use(express.static(path.join( __dirname , "public")));
app.set("view engine" , "ejs");
app.use(flash());
app.use('/' , indexRoutes)
app.use('/owner' , ownerRoutes );
app.use('/product' , productRoutes );
app.use('/user' , userRoutes)
app.listen(3000);