forked from Yara724/api
Fixed Swagger ui in prod
This commit is contained in:
56
src/main.ts
56
src/main.ts
@@ -54,38 +54,38 @@ async function bootstrap() {
|
||||
return challenge();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle("yara724-backend")
|
||||
.setVersion("1.0.0")
|
||||
.addServer(process.env.BASE_URL_DEV + "/api")
|
||||
.addServer("http://192.168.20.170:9001")
|
||||
.addServer("https://user.yara724.com/api")
|
||||
.addServer("http://localhost:9001")
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle("yara724-backend")
|
||||
.setVersion("1.0.0")
|
||||
.addServer(process.env.BASE_URL_DEV + "/api")
|
||||
.addServer("http://192.168.20.170:9001")
|
||||
.addServer("https://user.yara724.com/api")
|
||||
.addServer("http://localhost:9001")
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
|
||||
const docs = SwaggerModule.createDocument(app, config);
|
||||
const docs = SwaggerModule.createDocument(app, config);
|
||||
|
||||
SwaggerModule.setup("docs", app, docs, {
|
||||
swaggerOptions: {
|
||||
persistAuthorization: true,
|
||||
docExpansion: "none",
|
||||
ui: isDevelopment ? true : false,
|
||||
raw: isDevelopment ? true : false,
|
||||
tagsSorter: (a: string, b: string) => {
|
||||
const priority: Record<string, number> = {
|
||||
user: 0,
|
||||
actor: 1,
|
||||
};
|
||||
const pa = priority[a] ?? 100;
|
||||
const pb = priority[b] ?? 100;
|
||||
if (pa !== pb) return pa - pb;
|
||||
return a.localeCompare(b);
|
||||
SwaggerModule.setup("docs", app, docs, {
|
||||
swaggerOptions: {
|
||||
persistAuthorization: true,
|
||||
docExpansion: "none",
|
||||
ui: isDevelopment ? true : false,
|
||||
raw: isDevelopment ? true : false,
|
||||
tagsSorter: (a: string, b: string) => {
|
||||
const priority: Record<string, number> = {
|
||||
user: 0,
|
||||
actor: 1,
|
||||
};
|
||||
const pa = priority[a] ?? 100;
|
||||
const pb = priority[b] ?? 100;
|
||||
if (pa !== pb) return pa - pb;
|
||||
return a.localeCompare(b);
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
await app.listen(process.env.PORT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user