Davis.js is a JavaScript library that allows using Sinatra-style routing for web apps.
It uses HTML5′s new History/State API – PushState extensively, allowing vast amounts of code reuse.
You can define your app like this:
var app = Davis(function () {
this.get('/welcome/:name', function (req) {
alert("Hello " + req.params['name'])
})
})
app.start()
And set the routing links like this:
<a href="/welcome/oliver">greet oliver</a>
<a href="/welcome/bob">greet bob</a>
Pretty neat, huh?
If HTML5.PushState isn’t supported, davis.js falls back to normal form behavior so that the server can still work with the forms.
Davis even has some plugins, for example, you can track all davis.js requests with Google Analytics.
- Website: http://davisjs.com/
- Demo: http://davisjs.com/examples













