Files
BYW-VoiceHub/server/api/system/location.get.ts
T
Henry_Du 4ce4649aaf
Build VoiceHub FPK / build-fpk (push) Failing after 56m5s
Build and Push Docker Image / build-and-push (push) Canceled after 1h9m35s
初次提交
2026-09-06 08:19:02 +08:00

13 lines
341 B
TypeScript

import { getServerLocation } from '../../utils/geo'
export default defineEventHandler(async (event) => {
// 缓存 1 小时,避免频繁请求外部 IP 服务
setHeader(event, 'Cache-Control', 'public, max-age=3600, s-maxage=3600')
const location = await getServerLocation()
return {
success: true,
data: location
}
})