Tuesday, May 4th, 2010

Express: Sinatra for Node

Category: Node, Server

javascript
< view plain text >
  1. require.paths.unshift('path/to/express/lib')
  2. require('express')
  3.  
  4. get('/', function(){
  5.   this.redirect('/hello/world')
  6. })
  7.  
  8. get('/hello/world', function(){
  9.   return 'Hello World'
  10. })
  11.  
  12. get('/bye/world', function(){
  13.   this.render('title.html.haml', {
  14.     layout: false,
  15.     locals: {
  16.       title: 'Bye World'
  17.     }
  18.   })
  19. })
  20.  
  21. run()

In the rush to become either a Rails, or a Sinatra for server side JavaScript, we have Express. Clean and simple. Simple and clean.

Posted by Dion Almaer at 6:01 am
1 Comment

++++-
4 rating from 1 votes

1 Comment »

Comments feed TrackBack URI

sexy!

Comment by Kof — May 4, 2010

Leave a comment

You must be logged in to post a comment.