Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Static Cache | 286 | 1,100 | 254 | 2 years ago | 43 | August 03, 2020 | 12 | JavaScript | ||
[MAINTAINERS WANTED] Static cache for koa | ||||||||||
Koa2 Easy | 117 | 5 years ago | 38 | April 22, 2018 | JavaScript | |||||
Easy way to use koa2 | ||||||||||
Koa Hwtm | 17 | 8 years ago | 1 | JavaScript | ||||||
基于koa 构建的mvc 框架(http-websocket-tcp-mongodb),包括 http ,websocket,tcp ,mongodb 服务模块,目前可用于生产环境,以后有时间会继续维升级护,使用案例 http://letuis.com | ||||||||||
Compressor | 9 | 111 | 8 | 6 years ago | 4 | September 08, 2014 | mit | JavaScript | ||
[DEPRECATED] Compress middleware for koa that always compresses | ||||||||||
Kompression | 8 | 3 years ago | 2 | mit | JavaScript | |||||
This is a fork of koa-compress with support for brotli compression | ||||||||||
Vue2_koa2 | 6 | 6 years ago | 1 | JavaScript | ||||||
vue2_koa2 koa做中间层 vue2直出 | ||||||||||
Bank Match App | 5 | 5 years ago | JavaScript | |||||||
基于nextjs的hybrid app 页面 | ||||||||||
Bigkoa | 4 | 4 years ago | 1 | mit | JavaScript | |||||
bigbipe with koa | ||||||||||
Koa Simple Static | 2 | 2 years ago | other | TypeScript | ||||||
Simple caching static file server for Koa | ||||||||||
Koa Static Resolver | 2 | a year ago | mit | JavaScript | ||||||
Koa static file resolver, dirs, default index, path replace, cache, livereload, gzip |
Node6ES6 Babel-es2017Node6
Koa2Async/AwaitKoa2
koa2-easykoa2/koa2-easy
npm i koa2-easy -g
koa2
cd koa2-easy && npm i cnpm
run.js
Koa2babelES7Async/Awaitbabelrun.jsapp.js
node run.js
npm i
npm run dev
npm i pm2 -g
npm run pm2
PORT=8000 npm run dev
PORT=8000 npm run pm2
8000
VeryNginx Matcher host=app.xxxx.com host app.xxxx.com
Proxy Pass 127.0.0.1:3000
ES6
// router/index.js
router
.get('/', async ctx => {
//
// views
ctx.body = ctx.render('index', { title: 'Koa2-Easy' })
})
// router/index.js
router
.get('/index', async (ctx, next) => {
//
await ctx.send(ctx, 'index.html', { root: 'static/index' })
})
HTMLstatic
index.html/static/indexCSS
<!-- /static/index/index.html -->
<link rel="stylesheet" type="text/css" href="/index/css/index.css">
ctx.bodyjson
// router/test.js
router
.get('/json', (ctx, next) => {
ctx.body = { test: 'json' }
})
ctx.request.bodypost
// router/test.js
router
.post('/post', (ctx, next) => {
ctx.body = ctx.request.body
})
routerapp.js
// /api
// api/api
const router = new Router({
prefix: '/api'
})
// Api
router
.get('/', (ctx, next) => {
ctx.body = "This is Api page"
})
// app.js
import api from './router/api'
app.use(api.routes())