Requiring after express() call #32

Open
phzbox opened this Issue Sep 26, 2012 · 2 comments

Comments

Projects
None yet
2 participants

phzbox commented Sep 26, 2012

Not sure if it's considered an issue but when require('express-expose') is after var app = require('express')(), there is an error:

TypeError: Object function app(req, res){ app.handle(req, res); } has no method 'expose'

Code example that fails:

express = require('express')
app = express()
require('express-expose')
app.expose

Code example that works:

express = require("express")
require('express-expose')
app = express()
app.expose

It might strike as an odd use case but it happened while porting an app to express3.

Owner

tj commented Sep 26, 2012

we should change it anyway, it should be require('express-expose')(app)

phzbox commented Sep 26, 2012

That was the quick fix I used before understanding the ordering problem.. maybe it wasn't a total hack after all. Thanks

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