how to make POST REQUEST by next js 14 using axios or fetch but i prefer axios,
i try but alway show to me AxiosError: NewWorkError when try fetch show to me typeError: fetch faild
but it success with postman
i want sent request to http://localhost:3001/CreateUser
`
const POST = () => {
const PostRequest = async () => {
try {
const response await axios.post("http://localhost:3001/CreateUser", {
nameOfUser: "mostafa",
ageOfUser: 22,
phoneNumber: 201003443454,
EmailOfUser: "[email protected]",
})
} catch(error) {
console.log(error.message);
}
}
return <button onClick={() => PostRequest()}>POST</button>
}
export default POST;
`
i research in youtube and ask chat gpt and copilot and try by my self