-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
45 lines (35 loc) · 1000 Bytes
/
app.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
'use strict';
var koa = require('koa'),
mount = require('koa-mount'),
logger = require('koa-logger'),
views = require('koa-views'),
json = require('koa-json'),
serve = require('koa-static'),
gzip = require('koa-gzip'),
etag = require('koa-etag'),
// wan = require('wan/koa'),
// userauth = require('koa-userauth'),
// session = require('koa-generic-session'),
app = koa();
var haiku = require('./routers/haiku'),
author = require('./routers/author');
/* logging */
app.use(logger());
// app.use(session());
app.use(gzip());
app.use(etag());
// app.use(wan({ location: './assets/img/dest' }));
/* static files */
app.use(serve('./assets/js'));
app.use(serve('./assets/img/dest'));
app.use(serve('./assets/css'));
/* app.use(json({ pretty: false, param: 'pretty' })); */
/* templating */
app.use(views('views', {
default: 'jade',
cache: true
}));
/* mount routes */
app.use(mount('/haiku', haiku.middleware()));
app.use(mount('/author', author.middleware()));
app.listen(3000);