Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requiring after express() call #32

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

Requiring after express() call #32

phzbox opened this issue Sep 26, 2012 · 2 comments

Comments

@phzbox
Copy link

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.

@tj
Copy link
Member

tj commented Sep 26, 2012

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

@phzbox
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants