-
Notifications
You must be signed in to change notification settings - Fork 0
chore(deps): #64 drop unused @vercel/remote-nx #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cd42caf
chore(deploy): remove Vite-era root vercel.json (#62)
fray-cloud 828920a
feat(deploy): proxy data.go.kr through Next Route Handler (#63)
fray-cloud 927c907
feat(deploy): migrate proxy and types to data.go.kr API v2 (#63)
fray-cloud b610789
chore(deps): drop unused @vercel/remote-nx (#64)
fray-cloud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| # Korean public-data-portal service key for the abandonmentPublicSrvc API. | ||
| # Get one at https://www.data.go.kr/ and copy this file to apps/web/.env.local | ||
| # (which is git-ignored). | ||
| # (git-ignored). | ||
| # | ||
| # NEXT_PUBLIC_ prefix = exposed to the browser. A server-side proxy via a | ||
| # Next Route Handler is tracked under #9 (Vercel deploy); that will let us | ||
| # drop the NEXT_PUBLIC_ prefix and keep the key server-only. | ||
| NEXT_PUBLIC_DATA_GO_KR_SERVICE_KEY= | ||
| # Server-only — no NEXT_PUBLIC_ prefix. Read by the Next Route Handler | ||
| # at apps/web/app/api/data-go-kr/[...path]/route.ts; never shipped to | ||
| # the browser bundle. | ||
| DATA_GO_KR_SERVICE_KEY= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { NextRequest, NextResponse } from 'next/server'; | ||
|
|
||
| const UPSTREAM_BASE = | ||
| 'https://apis.data.go.kr/1543061/abandonmentPublicService_v2'; | ||
|
|
||
| export async function GET( | ||
| request: NextRequest, | ||
| context: { params: Promise<{ path: string[] }> } | ||
| ) { | ||
| const serviceKey = process.env.DATA_GO_KR_SERVICE_KEY; | ||
| if (!serviceKey) { | ||
| return NextResponse.json( | ||
| { error: 'DATA_GO_KR_SERVICE_KEY is not configured on the server.' }, | ||
| { status: 500 } | ||
| ); | ||
| } | ||
|
|
||
| const { path } = await context.params; | ||
| const upstreamPath = path.join('/'); | ||
|
|
||
| const params = new URLSearchParams(request.nextUrl.searchParams); | ||
| params.set('serviceKey', serviceKey); | ||
| params.set('_type', 'json'); | ||
|
|
||
| const upstreamUrl = `${UPSTREAM_BASE}/${upstreamPath}?${params.toString()}`; | ||
|
|
||
| try { | ||
| const upstream = await fetch(upstreamUrl, { | ||
| headers: { Accept: 'application/json' }, | ||
| }); | ||
| const body = await upstream.text(); | ||
| return new NextResponse(body, { | ||
| status: upstream.status, | ||
| headers: { | ||
| 'content-type': | ||
| upstream.headers.get('content-type') ?? 'application/json', | ||
| }, | ||
| }); | ||
| } catch (err) { | ||
| return NextResponse.json( | ||
| { error: 'Upstream fetch failed', message: String(err) }, | ||
| { status: 502 } | ||
| ); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: The
context.paramstype andawaitusage are inconsistent with Next.js route handler conventions.context.paramsshould be typed as a plain object, not aPromise. UsingPromise<{ path: string[] }>andawaithere misrepresents the actual type and can mislead TypeScript and future readers. Please update the signature tocontext: { params: { path: string[] } }and destructure withconst { path } = context.params;.Suggested implementation: