Files
artsite/server/api/experiences.get.ts
Arthur DANJOU f171be4460 feat: integrate evlog and enhance logging across API endpoints
- Added evlog and nuxthub dependencies in nuxt.config.ts and package.json.
- Implemented logging in various API endpoints (activity, contact, education, experiences, languages, projects, skills, stats, status-page, resumes) to track data retrieval and errors.
- Enhanced error handling in Wakatime fetch functions to log errors with additional context.
- Updated worker-configuration.d.ts to remove eslint-disable comments for better code quality.
2026-02-16 21:43:02 +01:00

21 lines
533 B
TypeScript

import { queryCollection } from '@nuxt/content/server'
export default defineCachedEventHandler(async (event) => {
const log = useLogger(event)
const result = await queryCollection(event, 'experiences')
.where('extension', '=', 'md')
.order('startDate', 'DESC')
.all()
if (result.length === 0) {
throw createError({ statusCode: 404, statusMessage: 'Experience records not found' })
}
log.set({ experiences: { count: result.length } })
return result
},
{
maxAge: 60 * 60 * 24,
name: 'experiences'
})