From 6295ee9664e264ad6ca617876c614209934ae9a1 Mon Sep 17 00:00:00 2001 From: Fityan <63894003+fityannugroho@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:09:49 +0700 Subject: [PATCH] feat: move documentation from `/docs` into root `/` (#461) * feat: move documentation from `/docs` into root `/` and remove `/docs` * docs: update documentation links to remove '/docs' path --- README.md | 4 ++-- docs/README_hi.md | 4 ++-- docs/README_id.md | 4 ++-- docs/README_ko.md | 4 ++-- docs/README_tl.md | 4 ++-- src/app.controller.ts | 25 ------------------------- src/main.ts | 2 +- test/app.e2e-spec.ts | 12 +++--------- 8 files changed, 14 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index ee65ab9..01856a2 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/README_hi.md b/docs/README_hi.md index e572ac0..c471219 100644 --- a/docs/README_hi.md +++ b/docs/README_hi.md @@ -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 खोलकर अपने स्थानीय मशीन में दस्तावेज़ तक पहुंच सकते हैं। ## लाइव डेमो diff --git a/docs/README_id.md b/docs/README_id.md index cf5b3bf..bde3839 100644 --- a/docs/README_id.md +++ b/docs/README_id.md @@ -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 diff --git a/docs/README_ko.md b/docs/README_ko.md index 57fd61e..138b60b 100644 --- a/docs/README_ko.md +++ b/docs/README_ko.md @@ -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 를 열어 로컬 머신에서 문서에 액세스할 수도 있습니다. (자세한 내용은 [시작하기](#시작하기) 참조) ## 라이브 데모 diff --git a/docs/README_tl.md b/docs/README_tl.md index cebb564..d85a153 100644 --- a/docs/README_tl.md +++ b/docs/README_tl.md @@ -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 diff --git a/src/app.controller.ts b/src/app.controller.ts index 490466b..ab3938d 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -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({ diff --git a/src/main.ts b/src/main.ts index 28221d8..741759c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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); diff --git a/test/app.e2e-spec.ts b/test/app.e2e-spec.ts index 6cf6186..5c48ac7 100644 --- a/test/app.e2e-spec.ts +++ b/test/app.e2e-spec.ts @@ -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 () => {