-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
45 lines (34 loc) · 1.03 KB
/
server.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
const dotenv = require('dotenv');
const express = require('express');
const app = express();
const http = require('http');
const path = require('path');
const router = require('./routes/index');
//dotenv.load();
dotenv.config();
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.json());
const config = {
//authRequired: false,
//auth0Logout: true
};
const port = process.env.PORT || 3000;
if (!config.baseURL && !process.env.BASE_URL && process.env.PORT && process.env.NODE_ENV !== 'production') {
config.baseURL = `http://localhost:${port}`;
}
//app.use(auth(config));
// Middleware to make the `user` object available for all views
/*
app.use(function (req, res, next) {
res.locals.user = req.oidc.user;
next();
});
*/
app.use('/', router);
http.createServer(app)
.listen(port, () => {
console.log(`Listening on ${config.baseURL}`);
console.log(process.env.NODE_ENV);
});