-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from capstone-maru/feat/geocoding-api
feat: hide the secret value of the geocoding API
- Loading branch information
Showing
7 changed files
with
48 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 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,28 @@ | ||
import axios from 'axios'; | ||
import { NextResponse, type NextRequest } from 'next/server'; | ||
|
||
import { type FromAddrToCoordDTO } from '@/features/geocoding'; | ||
|
||
export async function GET( | ||
request: NextRequest, | ||
{ params: { query } }: { params: { query: string } }, | ||
) { | ||
try { | ||
const response = await axios.get<FromAddrToCoordDTO>( | ||
`https://naveropenapi.apigw.ntruss.com/map-geocode/v2/geocode?query=${query}`, | ||
{ | ||
headers: { | ||
'X-NCP-APIGW-API-KEY-ID': process.env.NEXT_PUBLIC_NAVER_MAP_CLIENT_ID, | ||
'X-NCP-APIGW-API-KEY': | ||
process.env.NEXT_PUBLIC_NAVER_MAP_CLIENT_SECRET, | ||
}, | ||
}, | ||
); | ||
|
||
return new NextResponse(JSON.stringify(response.data), { status: 200 }); | ||
} catch (error) { | ||
return new NextResponse(JSON.stringify({ success: false }), { | ||
status: 400, | ||
}); | ||
} | ||
} |
This file contains 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 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 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 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 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