-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
39 lines (30 loc) · 1.08 KB
/
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
// Imports
const express = require('express')
const app = express()
const dotenv = require('dotenv');
const cookieParser = require('cookie-parser');
const chalk =require('chalk');
const Port = 8000
// DotENV Confing
dotenv.config({ path: './env'})
// Static files
app.use(express.static('assets'))
app.use('/css', express.static(__dirname + 'assets/css'))
app.use('/js', express.static(__dirname + 'assets/js'))
app.use('/images', express.static(__dirname + 'assets/images'))
// Auth Css/Jss/Image
app.use('/auth/css', express.static(__dirname + '/assets/css'))
app.use('/auth/js', express.static(__dirname + '/assets/js'))
app.use('/auth/images', express.static(__dirname + '/assets/images'))
app.set('view engine', 'hbs')
//Encoded
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
app.use(cookieParser());
// Define Routes
app.use('/', require('./routes/pages'));
app.use('/auth', require('./routes/auth'));
// App listening on specified port
app.listen(Port, () => {
console.log(chalk.green.bold.inverse(`Server is running at http://localhost:${Port}`));
});