axios post await

axios,web_developer,http,api,promise,await

Axios là một HTTP client được viết dựa trên Promises được dùng để hỗ trợ cho việc xây dựng các ứng dụng API từ đơn giản đến phức tạp. Có thể sử axios để post, get, put, delete...

Tips: Tìm hiểu sâu về axios

Post request

const newPost = {
    userId: 1,
    title: 'A new post',
    body: 'This is the body of the new post'
}
const sendPostRequest = async () => {
    try {
        const resp = await axios.post('https://jsonplaceholder.typicode.com/posts', newPost);
        console.log(resp.data);
    } catch (err) {
        // Handle Error Here
        console.error(err);
    }
}
sendPostRequest();

Có thể bạn đã miss một số snippets code

using Typescript callback style error handling

using javascript callback style error handling

await axios get

await axios get

Detect when your site is visible to users

Detect when your site is visible to users

axios post await

Axios là một HTTP client được viết dựa trên Promises được dùng để hỗ trợ cho việc xây dựng các ứng dụng API từ đơn giản đến phức tạp. Có thể sử axios để post, get, put, delete...