Activate your free membership today | Log-in

Tuesday, May 4th, 2010

Express: Sinatra for Node

Category: Node, Server

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

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

Related Content:

Posted by Dion Almaer at 6:01 am
1 Comment

OOOOO
Rate the above post

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.