feat: restructure API and documentation with new relay handler and UI components

This commit is contained in:
MythEclipse
2026-05-07 22:55:23 +07:00
parent fff35f02fe
commit 6f91d93672
3 changed files with 8 additions and 6 deletions
+7 -5
View File
@@ -4,8 +4,9 @@ HTTP proxy untuk Vercel Edge Runtime.
## Live Deployment ## Live Deployment
Endpoint utama: `https://proxy-bun.vercel.app/api/relay` - **API Endpoint**: `https://proxy-bun.vercel.app/`
Endpoint kedua: `https://vercel-relay-bgddcbfit-asepharyana71s-projects.vercel.app` - **Docs/Tester**: `https://proxy-bun.vercel.app/docs`
## Cara Pakai ## Cara Pakai
### Header yang Dibutuhkan ### Header yang Dibutuhkan
@@ -19,12 +20,12 @@ Endpoint kedua: `https://vercel-relay-bgddcbfit-asepharyana71s-projects.vercel.a
```bash ```bash
# Proxy # Proxy
curl -H "x-relay-target: https://jsonplaceholder.typicode.com/posts/1" https://proxy-bun.vercel.app/api/relay curl -H "x-relay-target: https://jsonplaceholder.typicode.com/posts/1" https://proxy-bun.vercel.app/
# Proxy ke endpoint spesifik # Proxy ke endpoint spesifik
curl -H "x-relay-target: https://api.example.com" \ curl -H "x-relay-target: https://api.example.com" \
-H "x-relay-path: /v1/users" \ -H "x-relay-path: /v1/users" \
https://proxy-bun.vercel.app/api/relay https://proxy-bun.vercel.app/
``` ```
### HTTP Methods ### HTTP Methods
@@ -57,7 +58,8 @@ HTTP 400 jika `x-relay-target` tidak ada.
proxy-bun/ proxy-bun/
├── src/ ├── src/
│ ├── app/ │ ├── app/
│ │ ── api/relay/route.ts # Edge handler │ │ ── docs/page.tsx # UI / Documentation
│ │ └── route.ts # Edge API handler
│ └── lib/ │ └── lib/
│ ├── relay-utils.ts # Pure functions untuk relay logic │ ├── relay-utils.ts # Pure functions untuk relay logic
│ └── relay-utils.test.ts # Unit tests │ └── relay-utils.test.ts # Unit tests
+1 -1
View File
@@ -51,7 +51,7 @@ export default function Home() {
fetchOptions.body = requestBody; fetchOptions.body = requestBody;
} }
const res = await fetch('/api/relay', fetchOptions); const res = await fetch('/', fetchOptions);
const elapsed = Date.now() - start; const elapsed = Date.now() - start;
let responseText = ''; let responseText = '';