Skip to content

Instantly share code, notes, and snippets.

@bpinedah
Created March 17, 2020 00:25
Show Gist options
  • Save bpinedah/cf84769a348b8a2e45b4b8b84d964540 to your computer and use it in GitHub Desktop.
Save bpinedah/cf84769a348b8a2e45b4b8b84d964540 to your computer and use it in GitHub Desktop.
Router article
/**
* @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