create a axios post in https in javascript

index.tsx
const axios = require('axios');

const postData = async () => {
    try {
        const response = await axios.post('https://api.example.com', {
            key1: 'value1',
            key2: 'value2'
        });
        console.log(response.data);
    } catch (error) {
        console.error(error);
    }
};

postData();
322 chars
16 lines

related categories

gistlibby LogSnag