forked from mapbox/mapbox-gl-draw
-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
47 lines (36 loc) · 1.16 KB
/
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
var express = require('express');
var app = express();
var browserify = require('browserify-middleware');
app.get('/mapbox-gl-draw.js', browserify('./index.js', {
standalone: 'MapboxDraw',
debug: true,
cache: 'dynamic',
minify: false
}));
app.get('/app.js', browserify('./debug/app.js', {
standalone: 'MapboxDraw',
debug: true,
cache: 'dynamic',
minify: false
}));
app.get('/mapbox-gl.js', function(req, res) {
res.sendFile(__dirname+'/node_modules/mapbox-gl/dist/mapbox-gl.js');
});
app.get('/mapbox-gl.css', function(req, res) {
res.sendFile(__dirname+ '/node_modules/mapbox-gl/dist/mapbox-gl.css');
});
app.get('/bench/index.js', browserify('./bench/index.js', {
transform: ['unassertify', 'envify'],
debug: true,
minify: true,
cache: 'dynamic'
}));
app.get('/bench/:name', function(req, res) {
res.sendFile(__dirname + '/bench/index.html');
});
app.use('/debug', express.static(__dirname + '/debug'));
app.use('/dist', express.static(__dirname + '/dist'));
var port = process.env.PORT || 9967;
app.listen(port, function () {
console.log('mapbox-gl-draw debug server running at http://localhost:' + port);
});