Koa2 Easy

Easy way to use koa2
Alternatives To Koa2 Easy
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Static Cache2861,1002542 years ago43August 03, 202012JavaScript
[MAINTAINERS WANTED] Static cache for koa
Koa2 Easy117
5 years ago38April 22, 2018JavaScript
Easy way to use koa2
Koa Hwtm17
8 years ago1JavaScript
基于koa 构建的mvc 框架(http-websocket-tcp-mongodb),包括 http ,websocket,tcp ,mongodb 服务模块,目前可用于生产环境,以后有时间会继续维升级护,使用案例 http://letuis.com
Compressor911186 years ago4September 08, 2014mitJavaScript
[DEPRECATED] Compress middleware for koa that always compresses
Kompression8
3 years ago2mitJavaScript
This is a fork of koa-compress with support for brotli compression
Vue2_koa26
6 years ago1JavaScript
vue2_koa2 koa做中间层 vue2直出
Bank Match App5
5 years agoJavaScript
基于nextjs的hybrid app 页面
Bigkoa4
4 years ago1mitJavaScript
bigbipe with koa
Koa Simple Static2
2 years agootherTypeScript
Simple caching static file server for Koa
Koa Static Resolver2
a year agomitJavaScript
Koa static file resolver, dirs, default index, path replace, cache, livereload, gzip
Alternatives To Koa2 Easy
Select To Compare


Alternative Project Comparisons
Readme

Node6ES6 Babel-es2017Node6

Koa2Async/AwaitKoa2

koa2-easykoa2/koa2-easy

npm i koa2-easy -g

koa2

cd koa2-easy && npm i cnpm

  1. artTemplate
  2. HTML
  3. Restful ApiCORS
  4. post
  5. ES6/7koa2Async/Await
  6. gzip
  7. TypeScript

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

Nginx

VeryNginx

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' })
  })

HTML

// router/index.js
router
  .get('/index', async (ctx, next) => {
    // 
    await ctx.send(ctx, 'index.html', { root: 'static/index' })
  })

HTML

HTMLstatic
index.html/static/indexCSS

<!-- /static/index/index.html -->
<link rel="stylesheet" type="text/css" href="/index/css/index.css">

JSON

ctx.bodyjson

// router/test.js
router
  .get('/json', (ctx, next) => {
    ctx.body = { test: 'json' }
  })

post

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())
Popular Koa Projects
Popular Gzip Projects
Popular Frameworks Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Es6
Javascript
Html
Koa
Koa2
Gzip
Await