koa-feather
v1.0.0
Published
A lightweight web framework based on koa.
Downloads
22
Readme
feather
A lightweight web framework based on koa.
快速开始
app.js
var feather = require('koa-feather');
var app = feather();
router.get('/', function* (next){
yield this.render('index',{});
});
路由设置
https://github.com/alexmingoia/koa-router
- router.get
- router.post
模版引擎
feather-views在koa-views的基础上做了简单的修改,以支持模版的layout。
router.get('/u/:id', function* (next) {
yield this.render('user', {
'user': this.params.id
});
});
views/user.html
{{user}}
views/layout.html
{{>yield}}
Session配置
在项目的package.json中添加配置信息
"session": {
"keys": "your secret key"
}