Created
December 5, 2020 07:32
-
-
Save nathan815/1fd6c43b99fe3717684d381c3885ec0a to your computer and use it in GitHub Desktop.
Socket.io Express Middleware Wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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