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