2 Star 2 Fork 1

koahubjs / koahub-demo-promise

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

KoaHub.js demo (Promise)

KoaHub.js

KoaHub.js -- 基于 Koa.js 平台的 Node.js web 快速开发框架。可以直接在项目里使用 ES6/7(Generator Function, Class, Async & Await)等特性,借助 Babel 编译,可稳定运行在 Node.js 环境上。

github地址:http://github.com/koahubjs/koahub

demo

下载安装

// 下载demo
git clone https://github.com/koahubjs/koahub-demo-promise.git
// 进入项目
cd koahub-demo-promise
// 安装依赖
npm install
// 启动项目
npm start

浏览器访问

http://localhost:3000

快捷方法中间件, 自定义post/file中间件

// use koa-body
koa.use(function (ctx, next) {

    if (!ctx.request.body.files) {
        ctx.post = ctx.request.body;
    } else {
        ctx.post = ctx.request.body.fields;
        ctx.file = ctx.request.body.files;
    }

    return next();
});

常见问题

1.模版引擎慢

默认模版引擎关闭了缓存,修改模版问题会立即生效。正式环境建议开启缓存,速度将提升10倍。

官网

KoaHub.js官网

空文件

简介

koahub-demo-promise 展开 收起
JavaScript
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/koahubjs/koahub-demo-promise.git
git@gitee.com:koahubjs/koahub-demo-promise.git
koahubjs
koahub-demo-promise
koahub-demo-promise
master

搜索帮助