Skip to content

Instantly share code, notes, and snippets.

@ali
Forked from anonymous/wut.coffee
Created December 18, 2012 03:25
Show Gist options
  • Save ali/4324740 to your computer and use it in GitHub Desktop.
Save ali/4324740 to your computer and use it in GitHub Desktop.
Node.js demo app thing
###
# Learning some Node/Express/Coffeescript :>
###
http = require 'http'
nouns = [
'ali', 'pranav', 'wylie', 'spencer',
'dnb', 'cba', 'thang', 'DDS', 'leebot'
]
adjectives = [
'smelly', 'awesome', 'in need of a rewrite',
'lazy', 'inefficient', 'radiant'
]
random = (array) ->
index = Math.floor(Math.random()*array.length)
array[index]
http.createServer((req, res) ->
noun = random nouns
adjective = random adjectives
sentence = noun + ' is ' + adjective
res.writeHead 200, {'Content-Type': 'text/plain'}
res.end sentence
).listen 3000
console.log 'You should hit up 0.0.0.0:3000'
@ali
Copy link
Author

ali commented Dec 18, 2012

Uploaded this using CLI Gist and forgot to login. Whoops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment