Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
164 lines (113 sloc) 4.02 KB


Test generators

ensure mongo and redis servers are running, then run

nodeunit test/


npm test

Testing API for controllers

Check out autogenerated tests for controllers, additional nodeunit stubs can be used:

test.redirect '/path'
test.render 'viewName'
test.send 'what'
test.success() # check status 200
test.assign 'memberName'

More stubs coming soon

Localize form labels automagically

Now form labels can be localized automatically, just use it as previously:

<% form_for(user, {}, function (form) { %>
    <%- form.label('name') %>
<% }); %>

And add translation to locales/en.yml:

        name: User name
        email: Email address

Jade templating engine (and any others)

Application can be generated with --tpl key, for now possibly values are

  • jade
  • ejs (default)

This list can be extended. Check out packages npm ejs-ext and jade-ext if you need to learn how to do it. It easy: just add another lang-ext package and install it before running railway g app --tpl lang


  • Merge javascripts and stylesheets
  • NPM 1.0.6 support (requires sudo npm link after railway init)
  • Filter parameter logging
  • CSRF protection (turned on by default)
  • Faster server startup (two-stage loading)

Small improvements:

  • By default static cache max age is one day
  • Merge js and css option turned on in production
  • Railway helpers now instantiated per request (localization support can be hooked up now)
  • Heroku-friendly app generation for mongo


  • Extension API
  • Logger support (app.set('quiet', true) now forces logger to log in log/ENV.log
  • Railway common API (almost all existing modules)
  • Observers support

Observer is a kind of controller, that listen for some event in the system, for example: paypal, twitter or facebook observers listens for callback from foreign service. Email observer may listen some events related to emails.

If you need app.on('someEvent') you should place this code in APPROOT/app/observers/NAME_observer.js


HTTPS Support

Just place your key and cert into config directory, railway will use it. Default names for keys are tsl.key and tsl.cert, but you can store in in another place, in that case just pass filenames to createServer function: server.js

require('railway').createServer({key: '/tmp/key.pem', cert: '/tmp/cert.pem'});


  • npmfile
  • Extenstions
  • Support (partially) security tokens generation


  • Localization in config/locales/*.yml
  • Coffeescript support for models, controllers and initializers
  • Disable caching settings: app.disable('model cache'); and app.disable('eval cache');


Scaffold generator railway generate scaffold ModelName field1:type1 field2:type2 It generates model, crud controller and appropriated views


Now you can run railway init blog and railway will create directory structure within blog root folder

By default will created file config/database.json that will force you to use mongoose driver, feel free to modify it and use redis or mysql (both supported)

Also, running express -t ejs no longer required


Mongoose driver support

Describe your schema in db/schema.js, it's just commonjs module which should export models. For describing logic please use app/models/*.js files. Every model described in schema accessible as global object in all models and controllers.


Added features generator for cucumis. Run railway generate features, then you will be able to create features using Gherkin language, parsed by kyuri.


  • CRUD generator
  • improved form_for helper
  • binary file bugfixes
  • layouts moved to app/views/layouts


  • Rewritten controllers
  • Rewritten models
  • ORM for mysql, redis, works like datamapper (e.g. one entity -- one object)
Something went wrong with that request. Please try again.