-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
49 lines (34 loc) · 859 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
38
39
40
41
42
43
44
45
46
47
48
49
'use strict'
var express = require('express');
var path = require('path');
var babelify = require('express-babelify-middleware');
var serveIndex = require('serve-index');
var app = express();
app.set('port', 9877);
//
// Application
//
const external = [
'three/three.js',
'@cycle/core',
'rx',
'd3',
'debug',
'underscore'
];
app.use('/bundle.js', babelify(external));
var appPath = path.resolve(__dirname, 'app', 'index.js');
app.use('/app.js', babelify(appPath, { external: external }));
app.use(express.static(appPath));
//
// Development
//
var devPath = path.resolve(__dirname, 'development');
app.use('/development', serveIndex(devPath));
app.use('/development', express.static(devPath));
//
// Static Files
//
var staticPath = path.resolve(__dirname, 'static');
app.use('/', express.static(staticPath));
module.exports = app;