Skip to content
A basic routes framework for JS that hooks in to HTML5 history
JavaScript
Latest commit b83c59a Feb 6, 2012 Paul Kinlan Fixes #10 - there are differences in .source on the regexp object bet…
…ween FF and Chrome, specifically FF will return the fully escaped string - this fix removes those differences
Failed to load latest commit information.
examples/client Fixes #6, form values are now attached to a values object that is on … May 31, 2011
lib/jasmine Adding more tests for parsing Mar 31, 2011
tests Fixes #10 - there are differences in .source on the regexp object bet… Feb 6, 2012
LICENCE First commit Mar 31, 2011
Makefile
README.md Fixing README May 23, 2011
SpecRunner.html Adding a custom event into pushState so that we can just have an app … Jun 7, 2011
routes-min.js Fixes #9 error with post porcessing Nov 3, 2011
routes.dart Thinking about adding dart support Feb 6, 2012
routes.js Fixes #9 error with post porcessing Nov 3, 2011

README.md

LeviRoutes

A simple lightweight routes framework for hooking in to HTML5 history. Currently when the system pop's state the route is triggered if matched.

var app = new routes();

app.get("/", function(req) {
  alert("State popped for /");
});

It also named parameters for route syntax

app.get("/:category", function(req) {
  alert("In " + req.params.category);
});

app.get("/:category.:format", function(req) {
  alert("format: " + req.params.format);
});

LeviRoutes can also intercept POST requests via forms, the framework will intercept all submits, and naturally let through requests that don't match the path, whilst firing your callback if there is a mathc

app.post("/:category", function(req) {
  alert("posting form: In Category ", req.params.category);
});
Something went wrong with that request. Please try again.