kaio
A minimalist middleware to get started faster with Koa.
Installation
npm install kaio --save
Example
Requirements
mkdir kaio-appcd kaio-appnpm install kaio koa-routertouch app.js
// app.js var kaio = ;var router = ; ; { next; if thisresstatusCode === 200 return; thisbody = 'Hello world!';} { var dataset = title: "The Fellowship of the Ring" author: "J. R. R. Tolkien" publication: "1954-07-29" title: "The Two Towers" author: "J. R. R. Tolkien" publication: "1954-11-11" title: "The Return of the King" author: "J. R. R. Tolkien" publication: "1955-10-20" ; var { var res = dataset; next; thisbody = res; }; var { var title = ; var res = dataset; next; thisbody = res; }; return ;}
Run the application
$ KO_PORT=1333 DEBUG=* node --harmony app.js
Test it
# 3000 is the default port but it is overriden by KO_PORT (1333) $ curl http://localhost:1333/api/Not found $ curl http://localhost:1333/api/Hello world! $ curl http://localhost:1333/api/books[{"title":"The Fellowship of the Ring","author":"J. R. R. Tolkien","publication":"1954-07-29"},{"title":"The Two Towers","author":"J. R. R. Tolkien","publication":"1954-11-11"},{"title":"The Return of the King","author":"J. R. R. Tolkien","publication":"1955-10-20"}] $ curl http://localhost:1333/api/books/The%2520Two%2520Towers{"title":"The Two Towers","author":"J. R. R. Tolkien","publication":"1954-11-11"}
API
Tests
npm test
Release History
- 0.5.0 Use confectioner module, add tests and upgrade public API
- 0.3.0 Replace custom resolver by dotresolver
- 0.1.0 Initial release