Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2012 03:24
Show Gist options
  • Save anonymous/4324737 to your computer and use it in GitHub Desktop.
Save anonymous/4324737 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Dec 18, 2012.
    30 changes: 30 additions & 0 deletions wut.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    ###
    # Learning some Node/Express/Coffeescript :>
    ###

    express = require 'express'
    app = express()

    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]

    app.get '/', (req, res) ->
    noun = random nouns
    adjective = random adjectives
    sentence = noun + ' is ' + adjective
    res.send sentence

    console.log 'You should hit up 0.0.0.0:3000'

    app.listen 3000