-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathindex.js
61 lines (50 loc) · 1.16 KB
/
index.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
50
51
52
53
54
55
56
57
58
59
60
61
var express = require('express'),
log = require('minilog')('browserify-cdn'),
cors = require('cors'),
compression = require('compression');
var bundler = require('./bundler'),
defaults = require('./defaults'),
admin = require('./admin'),
requestLogger = require('./request-logger');
var app = express(),
bundle = bundler(defaults());
var denylist = require('./denylist'),
singular = require('./singular'),
multiple = require('./multiple'),
statuses = require('./statuses');
app.routes = new express.Router();
//
// Block some cases that should just use their own CDN early
// so we don't run at 100% CPU and RAM all the frickin time
//
app.use(denylist);
//
// Add static assets
//
app.use(requestLogger);
app.use(cors());
app.use(app.routes);
app.use(compression());
app.use(express.static(__dirname + '/public'));
//
// Admin REST API
//
admin(app.routes, bundle);
//
// Single-module bundles
//
singular(app.routes, bundle);
//
// Multiple-module bundles
//
multiple(app.routes, bundle);
//
// Build statuses
//
statuses(app.routes, bundle);
//
// Exports
//
exports.app = app;
exports.bundler = bundler;
exports.defaults = defaults;