diff --git a/client/src/App.js b/client/src/App.js index a9099a1..75ac588 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,7 +1,18 @@ import React from 'react'; import './style/style.css'; +// import * as api from './api'; +// un-comment this ^ ^ ^ to import api endpoints function App() { + // React.useEffect(() => { + // api + // .getSomething() // replace this with your endpoint + // .then((response) => console.log(`✅ ${response.status} ${response.statusText}`, response.data)) + // .catch((error) => console.log(`❌ ${error}`)); + // }); + // + // example ^ ^ ^ using the api endpoint + return
Hello World - React.js
; } diff --git a/client/src/api/index.js b/client/src/api/index.js index bb413bc..d3e3550 100644 --- a/client/src/api/index.js +++ b/client/src/api/index.js @@ -1,6 +1,9 @@ import axios from 'axios'; +// customizable base-url const url = 'http://localhost:8080/'; +// demonstration endpoints: +// // export const getSomething = () => axios.get(url + 'path'); // export const postSometing = (form) => axios.post(url + 'path', form);