koas-swagger-ui
Version:
Koas Swagger UI serves Swagger UI. This requires the `specURL` variable to have been set on the `ctx.openApi` object. Typically this is done by combining it with [`koas-spec-handler`][].
18 lines (17 loc) • 503 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.relativeRequestPath = void 0;
/**
* Resolve a file relative to a URL path root.
*
* @param root - The URL root.
* @param file - The file to resolve
* @returns The resolve URL path
*/
function relativeRequestPath(root, file) {
if (root.endsWith('/')) {
return `${root}${file}`;
}
return root.split('/').slice(0, -1).concat(file).join('/');
}
exports.relativeRequestPath = relativeRequestPath;