Skip to content

Instantly share code, notes, and snippets.

@nathan815
Created December 5, 2020 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathan815/1fd6c43b99fe3717684d381c3885ec0a to your computer and use it in GitHub Desktop.
Save nathan815/1fd6c43b99fe3717684d381c3885ec0a to your computer and use it in GitHub Desktop.
Socket.io Express Middleware Wrapper
function wrapMiddleware(fn: (req: Request, res: Response, next: NextFunction) => void) {
return function (socket: Socket, next: (err?: ExtendedError) => void) {
fn(socket.request as Request, {} as Response, next as NextFunction);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment