-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
59 lines (47 loc) · 1.87 KB
/
index.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const express = require('express');
const chalk = require('chalk');
const debug = require('debug')('app');
const morgan = require('morgan');
const path = require('path');
const passport = require('passport');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const app = express();
const port = process.env.PORT || 8081;
app.use(morgan('tiny'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(session({ secret: 'o3iyh8bgYJN7rhmLfs' }));
app.use(express.static(path.join(__dirname, '/public')));
app.use('/css', express.static(path.join(__dirname, '/node_modules/bootstrap/dist/css')));
app.use('/css', express.static(path.join(__dirname, './src/resources/css')));
app.use('/fonts', express.static(path.join(__dirname, '/node_modules/bootstrap/dist/fonts')));
app.use('/fonts', express.static(path.join(__dirname, './src/resources/fonts')));
app.use('/js', express.static(path.join(__dirname, './src/resources/js')));
app.use('/js', express.static(path.join(__dirname, '/node_modules/bootstrap/dist/js')));
app.use('/js', express.static(path.join(__dirname, '/node_modules/jquery/dist')));
app.use('/img', express.static(path.join(__dirname, './src/resources/img')));
app.set('views', './src/views/');
app.set('view engine', 'ejs');
const nav = [
{ link: '/', title: 'Dashboard', icon: 'fa-bullseye', sub: 'Statistics and more' },
{ link: '/disks', title: 'Disks', icon: 'fa-tasks', sub: 'View and Manage' }
];
const title = 'BubbleDisks'
const diskRouter = require('./src/routes/diskroutes')(nav, title);
app.use('/disks', diskRouter);
app.get('/', (req, res) => {
res.render(
'index',
{
nav,
title,
active: 'Dashboard'
}
);
});
app.listen(port, () => {
debug(`Listening on port ${chalk.white(port)}`);
});