mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-22 06:53:26 +00:00
misc(apidocs): move URL route of API docs
This makes the Swagger UI route more consistent to the real API routes. Especially, the "private" prefix of the private API docs was irritating. Additionally, this commit adds a rule to the Caddyfile for proxying the API docs to the backend. Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
d52fc55ef3
commit
2225057ebe
3 changed files with 7 additions and 6 deletions
|
@ -29,16 +29,16 @@ export async function setupApp(
|
|||
mediaConfig: MediaConfig,
|
||||
logger: ConsoleLoggerService,
|
||||
): Promise<void> {
|
||||
setupPublicApiDocs(app);
|
||||
await setupPublicApiDocs(app);
|
||||
logger.log(
|
||||
`Serving OpenAPI docs for public api under '/apidoc'`,
|
||||
`Serving OpenAPI docs for public API under '/apidoc/v2'`,
|
||||
'AppBootstrap',
|
||||
);
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
setupPrivateApiDocs(app);
|
||||
await setupPrivateApiDocs(app);
|
||||
logger.log(
|
||||
`Serving OpenAPI docs for private api under '/private/apidoc'`,
|
||||
`Serving OpenAPI docs for private API under '/apidoc/private'`,
|
||||
'AppBootstrap',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ export async function setupPublicApiDocs(app: INestApplication): Promise<void> {
|
|||
const publicApi = SwaggerModule.createDocument(app, publicApiOptions, {
|
||||
include: [PublicApiModule],
|
||||
});
|
||||
SwaggerModule.setup('apidoc', app, publicApi);
|
||||
SwaggerModule.setup('apidoc/v2', app, publicApi);
|
||||
}
|
||||
|
||||
export async function setupPrivateApiDocs(
|
||||
|
@ -38,5 +38,5 @@ export async function setupPrivateApiDocs(
|
|||
const privateApi = SwaggerModule.createDocument(app, privateApiOptions, {
|
||||
include: [PrivateApiModule],
|
||||
});
|
||||
SwaggerModule.setup('private/apidoc', app, privateApi);
|
||||
SwaggerModule.setup('apidoc/private', app, privateApi);
|
||||
}
|
||||
|
|
|
@ -14,4 +14,5 @@ reverse_proxy /realtime http://127.0.0.1:3000
|
|||
reverse_proxy /api/* http://127.0.0.1:3000
|
||||
reverse_proxy /public/* http://127.0.0.1:3000
|
||||
reverse_proxy /uploads/* http://127.0.0.1:3000
|
||||
reverse_proxy /apidoc/* http://127.0.0.1:3000
|
||||
reverse_proxy /* http://127.0.0.1:3001
|
||||
|
|
Loading…
Reference in a new issue