Files
evilspins/server/api/sync-cards.post.ts
valere 0195c52d30
All checks were successful
Deploy App / build (push) Successful in 1m6s
Deploy App / deploy (push) Successful in 18s
test server NUXT_ env in nuxt config
2026-02-10 20:59:18 +01:00

28 lines
585 B
TypeScript

import { syncCardsWithDatabase } from '../services/cardSync.service'
export default defineEventHandler(async (event) => {
const runtimeConfig = useRuntimeConfig()
const folderPath = runtimeConfig.NUXT_PATH_FILES
if (!folderPath) {
throw createError({
statusCode: 500,
message: 'NUXT_PATH_FILES not configured'
})
}
try {
const result = await syncCardsWithDatabase(folderPath)
return {
success: true,
...result
}
} catch (error: any) {
throw createError({
statusCode: 500,
message: error.message
})
}
})