Skip to content

Commit

Permalink
mem changes to transit route
Browse files Browse the repository at this point in the history
  • Loading branch information
drewvolz committed Nov 25, 2024
1 parent 2dc2550 commit 9a1269e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions source/ccci-stolaf-college/v1/transit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import mem from 'memoize'
import {GH_PAGES} from './gh-pages.js'
import type {Context} from '../../ccc-server/context.js'

const GET = mem(get, {maxAge: ONE_HOUR})

export function getBus() {
return GET(GH_PAGES('bus-times.json')).json()
}
const getBus = mem(async () => {
const response = await get(GH_PAGES('bus-times.json'))
return response.json()
}, {maxAge: ONE_HOUR})

export async function bus(ctx: Context) {
ctx.cacheControl(ONE_HOUR)

ctx.body = await getBus()
}

export function getModes() {
return GET(GH_PAGES('transportation.json')).json()
}
const getModes = mem(async () => {
const response = await get(GH_PAGES('transportation.json'))
return response.json()
}, {maxAge: ONE_HOUR})

export async function modes(ctx: Context) {
ctx.cacheControl(ONE_HOUR)
Expand Down

0 comments on commit 9a1269e

Please sign in to comment.