forked from ionic-team/ionic-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
32 lines (25 loc) · 863 Bytes
/
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
var express = require("express");
var app = express();
var compress = require('compression');
var cookieParser = require('cookie-parser');
var processRequest = require('./server/processRequest');
var router = require('./server/router');
process.env.PWD = process.cwd()
console.log('PWD', process.env.PWD);
app.set('trust proxy', true);
app.use(compress());
app.use(cookieParser());
app.use(processRequest);
app.use(router(app));
app.use(express.static(process.env.PWD + '/_site/', {
maxage: 315360000000 // ten years
}));
app.use(function(req, res, next) {
res.status(404);
res.sendFile(__dirname + '/_site/404.html');
});
// bind the app to listen for connections on a specified port
var port = process.env.PORT || 3000;
app.listen(port);
// Render some console log output
console.log("Listening on port " + port);