Skip to content

Commit

Permalink
feat: move documentation from /docs into root / (#461)
Browse files Browse the repository at this point in the history
* feat: move documentation from `/docs` into root `/` and remove `/docs`
* docs: update documentation links to remove '/docs' path
  • Loading branch information
fityannugroho authored Nov 20, 2024
1 parent c8d07a2 commit 6295ee9
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 45 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ The data we used is based on official sources, managed in [**idn-area-data**](ht
## Documentation

Read the latest version of API documentation in the [documentation page](https://idn-area.up.railway.app/docs). This documentation is automatically generated using [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction).
Read the latest version of API documentation in the [documentation page](https://idn-area.up.railway.app). This documentation is automatically generated using [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction).

> You also can access the documentation in your local machine by running the app (see [Getting Started](#getting-started)) and open http://localhost:3000/docs in your browser.
> You also can access the documentation in your local machine by running the app (see [Getting Started](#getting-started)) and open http://localhost:3000 in your browser.
## Live Demo

Expand Down
4 changes: 2 additions & 2 deletions docs/README_hi.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
## प्रलेखन

[दस्तावेज़ीकरण पृष्ठ](https://idn-area.up.railway.app/docs) में एपीआई दस्तावेज़ का नवीनतम संस्करण पढ़ें। यह दस्तावेज़ [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction) का उपयोग करके स्वचालित रूप से तैयार किया जाता है।
[दस्तावेज़ीकरण पृष्ठ](https://idn-area.up.railway.app) में एपीआई दस्तावेज़ का नवीनतम संस्करण पढ़ें। यह दस्तावेज़ [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction) का उपयोग करके स्वचालित रूप से तैयार किया जाता है।

> आप ऐप चलाकर ([शुरू करना](#शुरू-करना) देखें) अपने ब्राउज़र में http://localhost:3000/docs खोलकर अपने स्थानीय मशीन में दस्तावेज़ तक पहुंच सकते हैं।
> आप ऐप चलाकर ([शुरू करना](#शुरू-करना) देखें) अपने ब्राउज़र में http://localhost:3000 खोलकर अपने स्थानीय मशीन में दस्तावेज़ तक पहुंच सकते हैं।
## लाइव डेमो

Expand Down
4 changes: 2 additions & 2 deletions docs/README_id.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Data yang kami gunakan menggunakan sumber yang resmi, dikelola di repositori [**
## Dokumentasi

Baca versi terbaru dokumentasi API di [halaman dokumentasi](https://idn-area.up.railway.app/docs). Dokumentasi ini dibuat secara otomatis menggunakan [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction).
Baca versi terbaru dokumentasi API di [halaman dokumentasi](https://idn-area.up.railway.app). Dokumentasi ini dibuat secara otomatis menggunakan [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction).

> Anda juga dapat mengakses dokumentasinya di perangkat lokal Anda dengan menjalankan aplikasi ini (lihat [Memulai](#memulai)) dan buka http://localhost:3000/docs di browser Anda.
> Anda juga dapat mengakses dokumentasinya di perangkat lokal Anda dengan menjalankan aplikasi ini (lihat [Memulai](#memulai)) dan buka http://localhost:3000 di browser Anda.
## Demo

Expand Down
4 changes: 2 additions & 2 deletions docs/README_ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
## 문서

최신 API 문서를 [문서 페이지](https://idn-area.up.railway.app/docs)에서 확인하세요. 이 문서는 자동으로 [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction)를 사용하여 생성됩니다.
최신 API 문서를 [문서 페이지](https://idn-area.up.railway.app)에서 확인하세요. 이 문서는 자동으로 [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction)를 사용하여 생성됩니다.

> 또한 앱을 실행하고 브라우저에서 http://localhost:3000/docs를 열어 로컬 머신에서 문서에 액세스할 수도 있습니다. (자세한 내용은 [시작하기](#시작하기) 참조)
> 또한 앱을 실행하고 브라우저에서 http://localhost:3000 열어 로컬 머신에서 문서에 액세스할 수도 있습니다. (자세한 내용은 [시작하기](#시작하기) 참조)
## 라이브 데모

Expand Down
4 changes: 2 additions & 2 deletions docs/README_tl.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Ang datos na aming ginamit ay batay sa opisyal na pinagkukunan na kinakalagaan s
## Dokumentasyon

Basahin ang pinakabagong bersyon ng dokumentasyon ng API sa [Pahina ng dokumentasyon](https://idn-area.up.railway.app/docs). Ang dokumentasyong ito ay awtomatikong nalilikha gamit ang [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction).
Basahin ang pinakabagong bersyon ng dokumentasyon ng API sa [Pahina ng dokumentasyon](https://idn-area.up.railway.app). Ang dokumentasyong ito ay awtomatikong nalilikha gamit ang [`@nestjs/swagger`](https://docs.nestjs.com/openapi/introduction).

> Puwede rin kayong mag-access sa dokumentasyon sa inyong lokal na makina sa pamamagitan ng pagsisimula ng aplikasyon (makita [Pagsisimula](#pagsisimula)) at buksan ang http://localhost:3000/docs sa iyong browser.
> Puwede rin kayong mag-access sa dokumentasyon sa inyong lokal na makina sa pamamagitan ng pagsisimula ng aplikasyon (makita [Pagsisimula](#pagsisimula)) at buksan ang http://localhost:3000 sa iyong browser.
## Live na pagpapakita

Expand Down
25 changes: 0 additions & 25 deletions src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,6 @@ import { ApiOkResponse, ApiOperation } from '@nestjs/swagger';

@Controller()
export class AppController {
@Get()
@ApiOperation({ description: 'Base route of this API.' })
@ApiOkResponse({
schema: {
type: 'object',
properties: {
statusCode: { type: 'number', example: 200 },
message: { type: 'string' },
version: {
type: 'string',
description: 'The version of this API.',
example: '1.0.0',
},
},
},
})
async index() {
return {
statusCode: HttpStatus.OK,
message: 'Welcome to Indonesia Area API.',
version: process.env.npm_package_version,
docs: '/docs',
};
}

@Get('health')
@ApiOperation({ description: 'Check the health of this API.' })
@ApiOkResponse({
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function bootstrap() {
// Create the API documentation.
const doc = SwaggerModule.createDocument(app, docConfig);
// Set the endpoint for API documentation.
const docPath = 'docs';
const docPath = '/';
// Setup the API documentation.
SwaggerModule.setup(docPath, app, doc);

Expand Down
12 changes: 3 additions & 9 deletions test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@ describe('AppController (e2e)', () => {
await tester.bootApp();
});

it('/ (GET)', async () => {
const res = await tester.expectOk('/');

expect(res.json()).toEqual(
expect.objectContaining({
message: expect.any(String),
version: process.env.npm_package_version,
}),
);
it('/health (GET)', async () => {
const res = await tester.expectOk('/health');
expect(res.json()).toEqual({ statusCode: 200, message: 'OK' });
});

afterAll(async () => {
Expand Down

0 comments on commit 6295ee9

Please sign in to comment.