-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
37 lines (31 loc) · 1014 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
33
34
35
36
37
'use strict';
var express = require('express');
var httpProxy = require('http-proxy');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var _ = require('lodash');
var app = express();
var apiProxy = httpProxy.createProxyServer();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(cookieParser());
/**************
* ROUTES:
**************/
// Default
app.get(/^\/(?!(vendor|editor|codemirror|config)\/).*/, function(req, res) {
res.sendFile('index.html', {
root: './target/build'
});
});
// Static Assets
app.use('/vendor', express.static('./target/build/vendor'));
app.use('/editor', express.static('./target/build/editor'));
app.use('/codemirror', express.static('./target/build/codemirror'));
app.use('/config', express.static('./target/build/config'));
/****************
* SERVER
****************/
var server = app.listen(3000, function() {
console.log('Listening on port %s...', server.address().port);
});