DEPRECATED runkoa:使用koa1和koa2时,无需关注babel的细节,无论哪种写法(common、generator、async)都能完美支持
DEPRECATED runkoa:使用koa1和koa2时,无需关注babel的细节,无论哪种写法(common、generator、async)都能完美支持
执行koa用到async的时候需要babel环境,这里稍微简单的封装了一下,以便于更简单的使用koa的时候,不用在意babel的细节
它是koa-generator的核心组件
node --harmony-async-awaitnpm i -g runkoarunkoa app.jsrequire('runkoa')(__dirname + '/app.js' )koa2支持3种写法,分别测试如下
Koa is an middleware framework, it can take 3 different kind function as middleware:
Here we write an logger middleware with different function.
runkoa app.js
runkoa app-async.js
runkoa app-generator.js 代码变动,使用supervisor或nodemon自动重启服务是开发里比较好的实践,runkoa可以非常好的和它们进行集成,让开发更简单
首先通过runkoa来加载bin/www里,代码如下
require('runkoa')(__dirname + '/app.js')然后执行
nodemon bin/www此时,你可以放心的去修改你的代码了
touch bin/run
var current_path = process.cwd();
require('runkoa')(current_path + '/bin/www' )然后执行pm2即可
#npm run pm2
pm2 start bin/run …这时正确的操作是
runkoa app.js依赖
请保持你的package.json或node_modules目录下无这些依赖即可
这是因为runkoa需要指定babel需要的preset地址
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)i5ting [email protected]如有建议或意见,请在issue提问或邮件
this repo is released under the MIT License.
暂无开放 Issues,或尚未同步最近议题。