Implement caching in the patch_detector, consume the cache from API routes in frontend
15 lines
403 B
TypeScript
15 lines
403 B
TypeScript
import { getChampionSummary } from '~/server/utils/cdragon-cache'
|
|
|
|
export default defineEventHandler(async () => {
|
|
try {
|
|
const championSummary = await getChampionSummary()
|
|
return championSummary
|
|
} catch (error) {
|
|
console.error('Error fetching champion summary:', error)
|
|
throw createError({
|
|
statusCode: 500,
|
|
statusMessage: 'Failed to fetch champion summary'
|
|
})
|
|
}
|
|
})
|