-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.js
52 lines (34 loc) · 958 Bytes
/
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
/*
* author: ralf
* ly nodejs mvc project
*/
var koa = require('koa');
var session = require('koa-generic-session');
var render = require('./modules/render');
var args = process.argv.splice(2);
//自定义部分
var statics = require('./modules/static')
var _mapper = require('./modules/mapper')(args[0])
var route = require('./modules/route')
var app = koa();
//静态资源 js css
app.use(statics(args[0]));
//session
app.keys = ['keys','gzgzmixcookie'];
app.use(session({
key:'dazong'
}));
//router
// app.use(router(app)); //开启路由
route.call(this,app,_mapper,render(args[0]))
app.on('error', function(err){
console.log(err);
});
app.listen(8070);
// var exec = require('child_process').execSync;
// var spawn = require('child_process').spawn,
// // ls = spawn('ttt');
// exec('source ./ttt')
// var exec = require('child_process').execSync;
// // var cmd = 'nohup node --harmony ../index.js dev &'
// exec('source ttt');