-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
41 lines (28 loc) · 830 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
const views = require('koa-views');
const logger = require('koa-logger');
const koaBody = require('koa-body');
const server = require('koa-static');
const session = require('koa-session');
const path = require('path');
const Koa = require('koa');
const app = module.exports = new Koa();
const router = require('./router')
app.keys = ['qweasd'];
// middleware
app.use(logger());
app.use(
views(
path.join(__dirname, '/views'), {
extension: 'html',
map: { html: 'swig' }
}
)
);
app.use(koaBody({ multipart: true }));
app.use(session(app));
app.use(server(path.join(__dirname, '/static')));
app.use(server(path.join(__dirname, '/photo')));
app.use(server(path.join(__dirname, '/video')));
app.use(router.routes());
app.listen(3001);
console.log('listening on port 3001');