Last active
December 14, 2018 07:37
-
-
Save alexpermiakov/9535e7eeab8e265f945650e221cfe591 to your computer and use it in GitHub Desktop.
Applies middleware on the router
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
import { Router } from "express"; | |
type Wrapper = ((router: Router) => void); | |
export const applyMiddleware = ( | |
middleware: Wrapper[], | |
router: Router | |
) => { | |
for (const f of middleware) { | |
f(router); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment