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:

  • XSLT expressions
    In the fifth part of his XSLT tutorial, Ed Tittel looks at XSLT expressions – the "transformation engine" behind XSLT; he also sums up a list of...
  • VMware launches PaaS offering Cloud Foundry: News in brief
    McAfee taps Reflex for virtual security; NTT America builds vCloud; BlueCat IPAM supports Hyper-V; Decision Lens deploys NetEx virtual appliance and...
  • The XPath Toolkit in Java 5
    William Brogden discusses the XML Path Language (XPath) and two different ways to put it to use in Java EE 5 Web...
  • XML at the command line with XSH
    Ed Tittel looks at XSH, a command-line XML shell that allows you to query and manipulate XML document trees on an ad hoc...
  • XSLT expression variables and data types
    In the fourth part of his XSLT tutorial, Ed Tittel covers XSLT variables and data types used in XSLT expressions and introduces you to XPath, the...

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.