Update express middleware for express.io

Express.io does not use the response object, so in the middleware the second argument will be the "next()" function. This fix allows it to use orm with express.io, while still fully support native express middleware functionality.