1.0.4 • Published 10 years ago

kob v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

Intro

Enhanced koa framework, support router and template

Installation

$ npm install kob

Example

var kob = require('kob');
var app = kob();

// same as koa

app.use(function* (){
  this.body = 'Hello World';
});

// auto compose middlewares

app.use(function* () {
  this.body = 'Hi'
}, function* () {
  this.body += ' Tony!';
});

// router

app.get('/:name', function* (name) {
  yield* this.render('template.html', { // using nunjucks
    name: name
  });
});

// support middlewares while using router

app.get('/:name', function* (next){
  this.hello = 'Hi ';
}, function* (name, next) {
  this.body = this.hello + name;
});


app.listen(3000);
1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago