express-expose
express-expose copied to clipboard
Requiring after express() call
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.
we should change it anyway, it should be require('express-expose')(app)
That was the quick fix I used before understanding the ordering problem.. maybe it wasn't a total hack after all. Thanks