From 1df328ad96b6ce4e60aedd196a5b4646dddc364f Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Thu, 7 May 2026 22:47:49 +0700 Subject: [PATCH] docs: update README with live deployment info and correct example commands --- README.md | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7451a68..ee26fb2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ HTTP proxy untuk Vercel Edge Runtime. +## Live Deployment + +Endpoint utama: `https://proxy-bun.vercel.app/api/relay` + ## Cara Pakai ### Header yang Dibutuhkan @@ -15,12 +19,12 @@ HTTP proxy untuk Vercel Edge Runtime. ```bash # Proxy -curl -H "x-relay-target: https://jsonplaceholder.typicode.com/posts/1" https://vercel-relay-alpha-umber.vercel.app/ +curl -H "x-relay-target: https://jsonplaceholder.typicode.com/posts/1" https://proxy-bun.vercel.app/api/relay # Proxy ke endpoint spesifik curl -H "x-relay-target: https://api.example.com" \ -H "x-relay-path: /v1/users" \ - https://vercel-relay-alpha-umber.vercel.app/ + https://proxy-bun.vercel.app/api/relay ``` ### HTTP Methods @@ -50,10 +54,13 @@ HTTP 400 jika `x-relay-target` tidak ada. ## Struktur Kode ``` -proxy-vercel/ -├── index.ts # Edge handler -├── relay-utils.ts # Pure functions untuk relay logic -└── index.test.ts # Unit tests +proxy-bun/ +├── src/ +│ ├── app/ +│ │ └── api/relay/route.ts # Edge handler +│ └── lib/ +│ ├── relay-utils.ts # Pure functions untuk relay logic +│ └── relay-utils.test.ts # Unit tests ``` ### relay-utils.ts @@ -61,7 +68,7 @@ proxy-vercel/ | Function | Deskripsi | |----------|-----------| | `normalizeTargetUrl(target, path)` | Gabung target + path, hapus trailing slash | -| `stripRelayHeaders(headers)` | Hapus relay-specific headers | +| `filterHeaders(headers)` | Filter relay & security headers | | `shouldSendBody(method)` | Cek apakah method butuh body | | `buildRelayRequest(req, url, headers)` | Bangun RequestInit untuk fetch | | `createRelayResponse(response)` | Buat Response dari fetch result | @@ -69,6 +76,6 @@ proxy-vercel/ ## Development ```bash -bun test # Run tests -bun run index.ts # Start local server (untuk manual testing) +bun test # Run tests +bun run dev # Start local Next.js server ```