-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-es.js
43 lines (26 loc) · 1.14 KB
/
app-es.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
'use strict';
var _koa = require('koa');
var _koa2 = _interopRequireDefault(_koa);
var _koaSimpleRouter = require('koa-simple-router');
var _koaSimpleRouter2 = _interopRequireDefault(_koaSimpleRouter);
var _initController = require('./controller/initController');
var _initController2 = _interopRequireDefault(_initController);
var _koaSwig = require('koa-swig');
var _koaSwig2 = _interopRequireDefault(_koaSwig);
var _co = require('co');
var _co2 = _interopRequireDefault(_co);
var _koaStatic = require('koa-static');
var _koaStatic2 = _interopRequireDefault(_koaStatic);
var _config = require('./config/config');
var _config2 = _interopRequireDefault(_config);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var app = new _koa2.default();
_initController2.default.init(app, _koaSimpleRouter2.default);
app.context.render = _co2.default.wrap((0, _koaSwig2.default)({
root: _config2.default.get('viewDir'),
autoescape: true,
cache: 'memory', // disable, set to false
ext: 'html'
}));
app.use((0, _koaStatic2.default)(_config2.default.get('staticDir')));
app.listen(_config2.default.get('port'));