Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ RUN pnpm install --frozen-lockfile

# Copy source and build
COPY . .
RUN pnpm build
RUN pnpm docs:build

# ---- Runtime image ----
FROM nginx:alpine

# Copy built assets
COPY --from=builder /app/dist /usr/share/nginx/html
COPY --from=builder /app/docs/.vitepress/dist /usr/share/nginx/html

# Copy nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
Expand Down
93 changes: 93 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { defineConfig } from 'vitepress'

export default defineConfig({
title: 'PICO SulTeng API',
description: 'API data COVID-19 komprehensif untuk Sulawesi Tengah dengan update real-time.',

head: [
['link', { rel: 'icon', href: '/pico-api-logo.webp' }],
],

locales: {
root: {
label: 'Indonesia',
lang: 'id',
themeConfig: {
nav: [
{ text: 'Panduan', link: '/panduan/memulai' },
{ text: 'Referensi API', link: '/api/overview' },
{ text: 'Live API', link: 'https://pico-api.banuacoder.com/api/v1/health' },
{ text: 'Swagger UI ↗', link: 'https://pico-api.banuacoder.com/swagger/index.html' },
],
sidebar: {
'/panduan/': [
{
text: 'Panduan',
items: [
{ text: 'Memulai', link: '/panduan/memulai' },
{ text: 'Autentikasi', link: '/panduan/autentikasi' },
{ text: 'Penanganan Error', link: '/panduan/error-handling' },
{ text: 'Glosarium', link: '/panduan/glosarium' },
],
},
],
'/api/': [
{
text: 'Referensi API',
items: [
{ text: 'Overview', link: '/api/overview' },
{ text: 'Health Check', link: '/api/health-check' },
{ text: 'Data Nasional (Terbaru)', link: '/api/national-latest' },
{ text: 'Data Nasional (Historis)', link: '/api/national-historical' },
{ text: 'Provinsi', link: '/api/provinces' },
{ text: 'Kasus Provinsi', link: '/api/province-cases' },
{ text: 'Kabupaten/Kota', link: '/api/regencies' },
{ text: 'Rumah Sakit', link: '/api/hospitals' },
{ text: 'Gugus Tugas', link: '/api/task-forces' },
{ text: 'Vaksinasi', link: '/api/vaccination' },
{ text: 'Statistik', link: '/api/statistics' },
],
},
],
},
},
},
en: {
label: 'English',
lang: 'en',
link: '/en/',
themeConfig: {
nav: [
{ text: 'Guide', link: '/en/panduan/memulai' },
{ text: 'API Reference', link: '/en/api/overview' },
],
sidebar: {
'/en/api/': [
{
text: 'API Reference',
items: [
{ text: 'Overview', link: '/en/api/overview' },
{ text: 'Health Check', link: '/en/api/health-check' },
{ text: 'National Data', link: '/en/api/national-latest' },
],
},
],
},
},
},
},

themeConfig: {
logo: '/pico-api-logo.webp',
socialLinks: [
{ icon: 'github', link: 'https://github.com/banua-coder/pico-api-go' },
],
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2024-present Banua Coder',
},
search: {
provider: 'local',
},
},
})
6 changes: 6 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import DefaultTheme from 'vitepress/theme'
import type { Theme } from 'vitepress'

export default {
extends: DefaultTheme,
} satisfies Theme
35 changes: 35 additions & 0 deletions docs/api/health-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Health Check

Cek status API dan konektivitas database.

## Endpoint

```
GET /api/v1/health
```

## Contoh Request

```bash
curl https://pico-api.banuacoder.com/api/v1/health
```

## Contoh Respons (Sehat)

```json
{
"data": {
"database": "connected",
"uptime": "72h30m15s"
},
"message": "API is healthy",
"status": true
}
```

## Penggunaan

Gunakan endpoint ini untuk:
- Memastikan API tersedia sebelum melakukan request lain
- Monitoring uptime aplikasi kamu
- Health check pada load balancer/proxy
23 changes: 23 additions & 0 deletions docs/api/hospitals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Rumah Sakit Rujukan

Daftar rumah sakit rujukan COVID-19.

## Endpoint

```
GET /api/v1/covid/hospitals
```

## Parameter Query

| Parameter | Tipe | Keterangan |
|-----------|------|------------|
| `page` | `number` | Halaman |
| `per_page` | `number` | Data per halaman |
| `regency_id` | `string` | Filter berdasarkan kabupaten/kota |

## Contoh Request

```bash
curl "https://pico-api.banuacoder.com/api/v1/covid/hospitals?regency_id=palu"
```
24 changes: 24 additions & 0 deletions docs/api/national-historical.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Data Nasional Historis

Riwayat data COVID-19 nasional Indonesia.

## Endpoint

```
GET /api/v1/covid/national/historical
```

## Parameter Query

| Parameter | Tipe | Wajib | Keterangan |
|-----------|------|-------|------------|
| `page` | `number` | ❌ | Halaman (default: 1) |
| `per_page` | `number` | ❌ | Data per halaman (default: 10) |
| `start_date` | `string` | ❌ | Tanggal mulai (YYYY-MM-DD) |
| `end_date` | `string` | ❌ | Tanggal akhir (YYYY-MM-DD) |

## Contoh Request

```bash
curl "https://pico-api.banuacoder.com/api/v1/covid/national/historical?page=1&per_page=30"
```
30 changes: 30 additions & 0 deletions docs/api/national-latest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Data Nasional Terbaru

Data COVID-19 nasional Indonesia paling terkini.

## Endpoint

```
GET /api/v1/covid/national/latest
```

## Field Respons

| Field | Tipe | Keterangan |
|-------|------|------------|
| `confirmed` | `number` | Total kasus terkonfirmasi |
| `recovered` | `number` | Total sembuh |
| `deaths` | `number` | Total meninggal |
| `active` | `number` | Kasus aktif |
| `date` | `string` | Tanggal data terakhir diperbarui |
| `new_confirmed` | `number` | Kasus baru hari ini |
| `new_recovered` | `number` | Sembuh baru hari ini |
| `new_deaths` | `number` | Meninggal baru hari ini |
| `fatality_rate` | `number` | Tingkat kematian (%) |
| `recovery_rate` | `number` | Tingkat kesembuhan (%) |

## Contoh Request

```bash
curl https://pico-api.banuacoder.com/api/v1/covid/national/latest
```
57 changes: 57 additions & 0 deletions docs/api/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Overview API

## Base URL

```
https://pico-api.banuacoder.com
```

## Versi API

Semua endpoint berada di bawah prefix `/api/v1/`.

## Endpoint yang Tersedia

| Endpoint | Method | Keterangan |
|----------|--------|------------|
| `/api/v1/health` | GET | Status kesehatan API |
| `/api/v1/covid/national/latest` | GET | Data nasional terbaru |
| `/api/v1/covid/national/historical` | GET | Data nasional historis |
| `/api/v1/covid/provinces` | GET | Daftar semua provinsi |
| `/api/v1/covid/provinces/:id` | GET | Data kasus provinsi spesifik |
| `/api/v1/covid/regencies` | GET | Daftar kabupaten/kota |
| `/api/v1/covid/hospitals` | GET | Daftar rumah sakit rujukan |
| `/api/v1/covid/task-forces` | GET | Daftar gugus tugas |
| `/api/v1/covid/vaccination` | GET | Data vaksinasi |
| `/api/v1/covid/statistics` | GET | Statistik agregat |

## Format Standar Respons

```json
{
"data": {},
"message": "success",
"status": true
}
```

## Paginasi

Endpoint list mendukung paginasi dengan parameter query:

```
?page=1&per_page=10
```

Respons akan menyertakan objek `pagination`:

```json
{
"pagination": {
"page": 1,
"per_page": 10,
"total": 34,
"total_pages": 4
}
}
```
22 changes: 22 additions & 0 deletions docs/api/province-cases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Kasus Provinsi Spesifik

Data COVID-19 detail untuk provinsi tertentu.

## Endpoint

```
GET /api/v1/covid/provinces/:id
```

## Parameter Path

| Parameter | Keterangan |
|-----------|------------|
| `id` | ID provinsi (misal: `sulteng`, `sulsel`, `dki-jakarta`) |

## Contoh Request

```bash
# Sulawesi Tengah
curl https://pico-api.banuacoder.com/api/v1/covid/provinces/sulteng
```
22 changes: 22 additions & 0 deletions docs/api/provinces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Provinsi

Daftar semua provinsi Indonesia beserta data COVID-19.

## Endpoint

```
GET /api/v1/covid/provinces
```

## Parameter Query

| Parameter | Tipe | Wajib | Keterangan |
|-----------|------|-------|------------|
| `page` | `number` | ❌ | Halaman (default: 1) |
| `per_page` | `number` | ❌ | Data per halaman |

## Contoh Request

```bash
curl "https://pico-api.banuacoder.com/api/v1/covid/provinces?page=1&per_page=34"
```
23 changes: 23 additions & 0 deletions docs/api/regencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Kabupaten/Kota

Data COVID-19 per kabupaten/kota.

## Endpoint

```
GET /api/v1/covid/regencies
```

## Parameter Query

| Parameter | Tipe | Wajib | Keterangan |
|-----------|------|-------|------------|
| `page` | `number` | ❌ | Halaman |
| `per_page` | `number` | ❌ | Data per halaman |
| `province_id` | `string` | ❌ | Filter berdasarkan provinsi |

## Contoh Request

```bash
curl "https://pico-api.banuacoder.com/api/v1/covid/regencies?province_id=sulteng"
```
15 changes: 15 additions & 0 deletions docs/api/statistics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Statistik

Data statistik agregat COVID-19.

## Endpoint

```
GET /api/v1/covid/statistics
```

## Contoh Request

```bash
curl https://pico-api.banuacoder.com/api/v1/covid/statistics
```
Loading
Loading