mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -05: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,
|
mediaConfig: MediaConfig,
|
||||||
logger: ConsoleLoggerService,
|
logger: ConsoleLoggerService,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
setupPublicApiDocs(app);
|
await setupPublicApiDocs(app);
|
||||||
logger.log(
|
logger.log(
|
||||||
`Serving OpenAPI docs for public api under '/apidoc'`,
|
`Serving OpenAPI docs for public API under '/apidoc/v2'`,
|
||||||
'AppBootstrap',
|
'AppBootstrap',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
setupPrivateApiDocs(app);
|
await setupPrivateApiDocs(app);
|
||||||
logger.log(
|
logger.log(
|
||||||
`Serving OpenAPI docs for private api under '/private/apidoc'`,
|
`Serving OpenAPI docs for private API under '/apidoc/private'`,
|
||||||
'AppBootstrap',
|
'AppBootstrap',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ export async function setupPublicApiDocs(app: INestApplication): Promise<void> {
|
||||||
const publicApi = SwaggerModule.createDocument(app, publicApiOptions, {
|
const publicApi = SwaggerModule.createDocument(app, publicApiOptions, {
|
||||||
include: [PublicApiModule],
|
include: [PublicApiModule],
|
||||||
});
|
});
|
||||||
SwaggerModule.setup('apidoc', app, publicApi);
|
SwaggerModule.setup('apidoc/v2', app, publicApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setupPrivateApiDocs(
|
export async function setupPrivateApiDocs(
|
||||||
|
@ -38,5 +38,5 @@ export async function setupPrivateApiDocs(
|
||||||
const privateApi = SwaggerModule.createDocument(app, privateApiOptions, {
|
const privateApi = SwaggerModule.createDocument(app, privateApiOptions, {
|
||||||
include: [PrivateApiModule],
|
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 /api/* http://127.0.0.1:3000
|
||||||
reverse_proxy /public/* 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 /uploads/* http://127.0.0.1:3000
|
||||||
|
reverse_proxy /apidoc/* http://127.0.0.1:3000
|
||||||
reverse_proxy /* http://127.0.0.1:3001
|
reverse_proxy /* http://127.0.0.1:3001
|
||||||
|
|
Loading…
Reference in a new issue