-
-
Save ali/4324740 to your computer and use it in GitHub Desktop.
Node.js demo app thing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# 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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uploaded this using CLI Gist and forgot to login. Whoops.