Skip to content

Commit

Permalink
feat: fix swagger-ui source 404
Browse files Browse the repository at this point in the history
  • Loading branch information
dongwa committed Jan 31, 2024
1 parent 8256050 commit adffb89
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,23 @@ export const build: BuildV2 = async (options) => {

const swaggerOutputs = await glob('**', swaggerUIPath, swagger);
for (const swaggerSrc in swaggerOutputs) {
output[swaggerSrc] = swaggerOutputs[swaggerSrc];
output[`${swagger}${swaggerSrc}`] = swaggerOutputs[swaggerSrc];
if (swaggerSrc.endsWith('.map')) continue;
const relaPath = relative(baseDir, swaggerOutputs[swaggerSrc].fsPath);
output[relaPath] = swaggerOutputs[swaggerSrc];
customStaticRoute.push({
src: swaggerSrc,
dest: `/${relaPath}`,
});
customStaticRoute.push({
src: `${swagger}${swaggerSrc}`,
dest: `/${relaPath}`,
});
}
}

// @TODO:support config routes and static routes
routes = [
...customStaticRoute,

{
src: '/(.*)',
dest: `/${nestLambdaName}`,
Expand Down

0 comments on commit adffb89

Please sign in to comment.