mirror of
https://github.com/kremalicious/location.git
synced 2024-12-04 15:04:46 +01:00
set Cache-Control response headers
This commit is contained in:
parent
d6dc37f4f8
commit
9eb4f1cd2a
10
api/index.ts
10
api/index.ts
@ -1,4 +1,4 @@
|
|||||||
import { getLastCheckin } from '../lib/foursquare'
|
// import { getLastCheckin } from '../lib/foursquare'
|
||||||
import { NomadListLocation, getNomadList } from '../lib/nomadlist'
|
import { NomadListLocation, getNomadList } from '../lib/nomadlist'
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
@ -14,7 +14,7 @@ declare type LocationResponse = {
|
|||||||
next: Location
|
next: Location
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET() {
|
||||||
try {
|
try {
|
||||||
const nomadlist = await getNomadList()
|
const nomadlist = await getNomadList()
|
||||||
// const foursquare = await getLastCheckin()
|
// const foursquare = await getLastCheckin()
|
||||||
@ -26,7 +26,11 @@ export async function GET(request: Request) {
|
|||||||
} as LocationResponse
|
} as LocationResponse
|
||||||
|
|
||||||
return new Response(JSON.stringify(response, null, 2), {
|
return new Response(JSON.stringify(response, null, 2), {
|
||||||
headers: { 'content-type': 'application/json' }
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Cache-Control': 's-maxage=300, stale-while-revalidate=300'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return new Response(JSON.stringify(error, null, 2), { status: 500 })
|
return new Response(JSON.stringify(error, null, 2), { status: 500 })
|
||||||
|
Loading…
Reference in New Issue
Block a user