-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
31 lines (23 loc) · 851 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
const express = require('express');
const path = require('path');
const dotenv = require('dotenv');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const app = express();
dotenv.config({ path: './.env'});
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({ extended: true }));
const publicDirectory = path.join(__dirname, './public');
app.use(express.static(publicDirectory));
// Parse JSON bodies (as sent by API clients)
app.use(express.json());
app.use(cookieParser());
//Define Routes
app.use('/', require('./routes/pages'));
app.use('/auth', require('./routes/auth'));
const PORT = process.env.PORT || 3000
app.listen(PORT, function(){
console.log('Server has started');
});
// modules to install
// express body-parser mysql2 ejs request dotenv cookie-parser jsonwebtoken bcryptjs