import axios from "axios"; export default defineEventHandler(async (event) => { // Read the body of the incoming request const body = await readBody(event); try { const response = await axios.post("http://localhost:8082/api/suratkontrol/cari", body, { headers: { "Content-Type": "application/json", }, }); console.log(response.data) return response.data } catch (error) { console.error("Error posting to surat kontrol API:", error); throw createError({ statusCode: 500, statusMessage: "Failed to fetch data from surat kontrol API", }); } });