-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathserver.js
35 lines (33 loc) · 1004 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
#!/usr/bin/env node --harmony
var gutil = require('gulp-util');
var koa = require('koa');
var koaBody = require('koa-body');
var path = require('path');
var jscoverHandler = require('koa-node-jscover');
var jscoverCoveralls = require('node-jscover-coveralls/lib/koa');
var serve = require('koa-static');
var app = koa();
var mount = require('koa-mount');
var cwd = process.cwd();
var serveIndex = require('koa-serve-index');
var modularize = require('koa-modularize');
app.use(koaBody());
app.use(jscoverHandler({
jscover:require('node-jscover'),
next:function(){
return 1;
}
}));
app.use(mount('/lib/', modularize(path.resolve(__dirname,'lib'))));
app.use(mount('/tests/browser/specs/',modularize(path.resolve(__dirname,'tests/browser/specs/'))));
app.use(jscoverCoveralls());
app.use(serveIndex(cwd, {
hidden: true,
view: 'details'
}));
app.use(serve(cwd, {
hidden: true
}));
var port = process.env.PORT || 8014;
app.listen(port);
gutil.log('server start at ' + port);