Skip to content

Instantly share code, notes, and snippets.

@geoah
Created December 25, 2012 11:10
Show Gist options
  • Save geoah/4372713 to your computer and use it in GitHub Desktop.
Save geoah/4372713 to your computer and use it in GitHub Desktop.
ExpressJs Issue 1277 Test case - https://github.com/visionmedia/express/issues/1277 npm install express jade npm install coffee-script -g coffee app.coffee http://localhost:1014/
# -------------------------------------------------------------------------
# FIlE app.coffee
# -------------------------------------------------------------------------
express = require 'express'
app = express()
server = app.listen 1014
app.set 'views', __dirname + '/views'
app.set 'view engine', 'jade'
app.configure ->
app.use express.logger format: ':method :url :status'
app.use express.errorHandler
dumpExceptions: true
showStack: true
# This will not work
app.use(express.vhost('localhost', require('./apps/hub').app))
# This is working as expected
#app.get '/', (req, res, next) ->
# res.render 'index'
# -------------------------------------------------------------------------
# FILE apps/hub.coffee
# -------------------------------------------------------------------------
express = require 'express'
app = express()
app.get '/', (req, res, next) ->
console.info "#{req.uri} > GET /"
res.render 'index'
module.exports.app = app
# -------------------------------------------------------------------------
# FILE views/index.jade
# -------------------------------------------------------------------------
h1 Hello World!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment