1.0.5 • Published 12 years ago

ika v1.0.5

Weekly downloads
17
License
-
Repository
github
Last release
12 years ago

イカ

braindead routes.

var routes = require('ika').routes
routes.add('GET', /\/borges\/(\w+)\//, function(book) {
    this.res.writeHead(200, {'Content-Type':'text/plain'})
    if (book === 'babel') {
        this.res.end('a triangular room is inconceivable')
    }
    else {
        this.res.end('no such book')
    }
})

routes.add('POST', '/borges/add/', function() {
   // do work 
})
var server = http.createServer(function(req, res) {
    routes.route(req, res)
})
  • pass a regex literal or a string
  • req and res are properties in the context of the callback
  • captured args in regex are passed as params to callback
  • that's it.

meta

ika was written by nathaniel k smith nathanielksmith@gmail.com and is licensed under the terms of the GPL3.

1.0.5

12 years ago

1.0.4

12 years ago

1.0.3

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago