Created
March 17, 2020 00:25
-
-
Save bpinedah/cf84769a348b8a2e45b4b8b84d964540 to your computer and use it in GitHub Desktop.
Router article
This file contains hidden or 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
/** | |
* @description Get path parameters by router route | |
* @param routePath Path from route | |
* @param requestPath Path from request | |
* @returns {{params: {}, base: *}} | |
* @private | |
*/ | |
_getPathParams(routePath, requestPath) { | |
const { match } = require("path-to-regexp"); | |
const _match = match(routePath, {decode: decodeURIComponent}); | |
return _match(requestPath); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment