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

Kiểm tra phần tử trùng trong mảng JavaScript

Kiểm tra phần tử trùng trong mảng JavaScript.

await axios get

await axios get

Promise.all là gì?

Promise.all là gì? Hiểu và sử dụng promise all trong những trường hợp nào trong vòng 1 phút.

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...