diff --git a/day-04/promise/postOneEmployeebyOguz.js b/day-04/promise/postOneEmployeebyOguz.js new file mode 100644 index 0000000..9cf240f --- /dev/null +++ b/day-04/promise/postOneEmployeebyOguz.js @@ -0,0 +1,14 @@ +import fetch from "node-fetch"; + +const url = "http://localhost:8080/api/employees/add"; +const body = { firstName: "Oğuz", lastName: "Bilgin" }; + +const response = await fetch(url, { + method: "POST", + body: JSON.stringify(body), + headers: { + "Content-Type": "application/json", + }, +}).then((resp) => resp.json()); + +console.log(response);