Code URL : https://programming-4-students.blogsp...
Steps on how to use axios to access external websites/api's. The API's presented in this video are written in PHP located in separate server.
install axios
npm install axios
import axios
import axios from 'axios'
use axios to access external API
ex:
const url = 'http://localhost/api/hello.php';
const response = await axios.get(url);
command 1
//with parameters
const response = await axios.get(url,
{ params: {
yearLevel : '1'
}});
//use .data property for the data returned by the API