gistlib
index.tsx// Import axios library in your code const axios = require('axios'); // Define the endpoint URL const url = 'https://api.example.com/data'; // Make a POST request axios.post(url, { key1: 'value1', key2: 'value2' }) .then(function (response) { console.log(response.data); }) .catch(function (error) { console.log(error); }); // Make a GET request axios.get(url) .then(function (response) { console.log(response.data); }) .catch(function (error) { console.log(error); }); 485 chars27 lines
// Import axios library in your code const axios = require('axios'); // Define the endpoint URL const url = 'https://api.example.com/data'; // Make a POST request axios.post(url, { key1: 'value1', key2: 'value2' }) .then(function (response) { console.log(response.data); }) .catch(function (error) { console.log(error); }); // Make a GET request axios.get(url) .then(function (response) { console.log(response.data); }) .catch(function (error) { console.log(error); });
gistlibby LogSnag