-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
44 lines (29 loc) · 1.02 KB
/
index.js
File metadata and controls
44 lines (29 loc) · 1.02 KB
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
const express = require('express');
const app = express();
const path = require('path');
const morgan = require('morgan');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const cors = require('cors');
const dotenv = require('dotenv');
const expressLayouts = require('express-ejs-layouts');
dotenv.config();
const connectDB = require('./config/db');
const { urlencoded } = require('body-parser');
connectDB();
var PORT = process.env.PORT || 4000;
app.use(expressLayouts)
app.set('layout', __dirname+'/views/layout/main.ejs')
app.set("view engine", "ejs");
app.use(express.urlencoded({extended:false}));
app.use(cors());
app.use(express.json());
app.use(cookieParser());
app.use(express.static(path.join(__dirname+'/public')));
app.use('/', require('./routes/index'));
app.use('/auth', require('./routes/auth'));
app.use('/dashboard', require('./routes/dashboard'));
app.use('/blog', require('./routes/blog'));
app.listen(PORT, () => {
console.log("Server started at port", PORT);
});