forked from ionic-team/ionic-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
44 lines (32 loc) · 1.07 KB
/
Copy pathindex.ts
File metadata and controls
44 lines (32 loc) · 1.07 KB
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
import {config as dotenv } from 'dotenv';
import * as express from 'express';
import * as compress from 'compression';
import * as helmet from 'helmet';
import { join } from 'path';
import * as config from './config';
import * as pageNotFound from './pageNotFound';
import { default as processRequest } from './processRequest';
dotenv({silent: true});
const app = express();
process.env.PWD = process.cwd();
console.log('PWD', process.env.PWD);
app.set('trust proxy', true);
app.use(compress());
app.use(helmet());
app.use(processRequest);
app.enable('etag');
app.use(express.static(process.env.PWD + '/www/', {
etag: true
}));
app.get('/', function (req, res) {
res.redirect('/docs');
});
app.get(/^(.(?!.*\.md$|.*\.js))*$/, function (req, res) {
res.sendFile('docs/index.html', { root: join(__dirname, '../../www')});
});
// app.use(pageNotFound);
// bind the app to listen for connections on a specified port
app.listen(config.PORT, function() {
// Render some console log output
console.log('Listening on port ' + config.PORT);
});