Initial commit.

This commit is contained in:
Jonathan Cremin 2015-07-09 23:01:43 +01:00
commit b48a4e92e1
169 changed files with 7538 additions and 0 deletions

35
app.js Normal file
View file

@ -0,0 +1,35 @@
import koa from 'koa';
import mount from 'koa-mount';
import spdy from 'spdy';
import api from './api/app';
import web from './web/app';
import { init as storageInit } from './lib/storage';
import debugname from 'debug';
const debug = debugname('hostr');
storageInit();
const app = koa();
app.keys = [process.env.KEYS || 'INSECURE'];
app.use(mount('/api', api));
app.use(mount('/', web));
if (!module.parent) {
if (process.env.LOCALHOST_KEY) {
spdy.createServer({
key: process.env.LOCALHOST_KEY,
cert: process.env.LOCALHOST_CRT
}, app.callback()).listen(4040, function() {
debug('Koa SPDY server listening on port ' + (process.env.PORT || 4040));
});
} else {
app.listen(process.env.PORT || 4040, function() {
debug('Koa HTTP server listening on port ' + (process.env.PORT || 4040));
});
}
}
module.exports = app;