How should I implement a RESTful API with a web frontend in Node.js?
It doesn't make sense to use a complex framework such as Railway, which is built on top of Express and tries to resemble Ruby on Rails.
You should either choose Express or Restify, not both.
I would pick Express over Restify because the code is excellently documented and the library is more mature and heavily used. You can find a bunch of useful tutorials on how to make such apps with Express, and the API is great:
var express = require('express') , app = express.createServer();var users = [{ name: 'tj' }];app.all('/user/:id/:op?', function(req, res, next){ req.user = users[req.params.id]; if (req.user) { next(); } else { next(new Error('cannot find user ' + req.params.id)); }});app.get('/user/:id', function(req, res){ res.send('viewing ' + req.user.name);});app.get('/user/:id/edit', function(req, res){ res.send('editing ' + req.user.name);});app.put('/user/:id', function(req, res){ res.send('updating ' + req.user.name);});app.get('*', function(req, res){ res.send('what???', 404);});app.listen(3000);
I personally find express.js to suit my needs because of it's routing functionality that is great. Check out http://expressjs.com/guide.html#routing. It gets the job done for a RESTful api and is extremely fast.
also: Node-PerfectAPI vs Restify.js vs ExpressJS vs Node-APIServer