I like tinkering with front-end frameworks. And I usually like to have a server behind the app so I can actual play with all the framework features (saving and updating models, using client-side routing, and so on).
Usually, I want a server that does two things:
- serves the public directory
- has a REST API that can interact with models
I've written a server like this so many times that I decided to fold it all into a neat NPM package: repose. This will make playing with frameworks easier for me, so maybe it will for you too.
My little repose library actually just wraps a simple Express application. You just give it a model name, and it will return an Express application. That app has the routes of a REST API, and will server the
var repose = require('repose'); var app = repose('widgets'); app.listen(3000);
This gives you the following routes:
Any other requests will get the
public/index.html page. For a few more details, see the README.