This is a JavaScript library that helps in progressively enhancing websites. It is relying on pushState, replaceState, onPopState and plain JavaScript to give the user the impression a request is handled on the server, when in fact the request is handled on the client itself. The library is a client side implementation of the Express* API. The goal here is to promote re-use of the routing and templating logic from the server on the client.
* Express is a high performance, high class web development framework for Node.js.
This website has been created using Node.js and Express on the server and Client Express on the client. Each page will show where the main content was generated. You may also want to open FireBug which will show you the log output which will show what route was triggered.
When we look at a simple Express configuration, and then take a look at the same configuration for Client Express them you may notice a striking similarity between the two.
Express configuration:var express = require('express'); var server = express.createServer(); server.get('/', function(request, response) { response.send('hello world'); }); server.listen(3000);Client Express configuration:
var express = require('express'); var server = express.createServer(); server.get('/', function(request, response) { response.send('hello world'); }); server.listen(3000); // this of course doesn't do anything
The source code of the Client Express library as well as the source code for this website can be found on GitHub please use it and provide feedback.
GitHub: https://github.com/MarkNijhof/client.express.js
The Client Express library can be downloaded from here, I would recommend not to link it from here:
Twitter: @MarkNijhof Blog: http://cre8ivethought.com/blog/index E-mail: Mark.Nijhof (@) Cre8iveThought.com