cosette/server/api/comment.post.js
2022-08-13 11:56:59 +02:00

12 satır
No EOL
318 B
JavaScript

import { addComment } from '../controller'
import { useBody } from 'h3'
export default defineEventHandler(async (event) => {
try {
const body = await useBody(event)
const comment = addComment(body)
return { success: true, comment }
} catch (e) {
return { success: false, reason: e.message }
}
})