Today Is the day I present you a thing I did want to build since a long time :

A simple JS router (hash styled & for front-end use) with ajax ability

It is called Z-router and here are some information about it :

How does it work

Z-Router watches the hash part # of the current url and displays the corresponding template based on the routes declaration.

You can pass parameters inside the url and use it in the template. It is also possible to add options on the routes, they will be available in the template too.

You can provide a template to Z-router by two ways :

. an inline string with html inside
. a url to an external template (html file)

There is also a “template engine” that will transform the html before rendering it if needed. (Template engine inspiration)


There are a lot of things to know about it!

Click here to see the full documentation


See the Pen adKoZX by Benjamin CARADEUC (@benavern) on CodePen.

This project is meant to evolve but is fully usable as-is today.

You can contribute, fork, issue on github and please comment below!

See you next hack ;-)