-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (29 loc) · 970 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
32
33
34
35
// grab the packages we need
const express = require('express');
const app = express();
const path = require('path');
const routes = require('./routes');
const favicon = require('serve-favicon');
const logger = require('morgan');
const compression = require('compression');
// Import the Anagrammatix game file.
var faceoff = require('./helpers/faceoff');
// Connect all our routes to our application
//app.all('*', ensureSecure);
app.use(compression());
app.use(favicon(__dirname + '/resources/logo.ico'));
app.use(logger('dev'));
app.use('/', routes);
app.use(express.static(path.join(__dirname, '/')));
app.use(express.static(path.join(__dirname, '/public')));
app.use(express.static(path.join(__dirname, '/views')));
// set the view engine to ejs
app.set('view engine', 'ejs');
// Redirect Function
function ensureSecure(req, res, next) {
if(req.secure) {
return next();
}
res.redirect('https://' + req.hostname + req.url);
}
module.exports = app;