Bando Documentation
React and REST
Consume the Bando API from any application capable of making HTTP requests.
Bando with React, Next.js, or any frontend
Bando is not tied to a specific framework. Any frontend capable of making HTTP requests can consume Bando content.
This includes React, Next.js, Vue, mobile applications, and other projects that work with HTTP.
Using fetch
const response = await fetch(
"http://localhost:3333/api/posts",
{
headers: {
"X-Bando-API-Key": "YOUR_API_KEY",
},
}
);
const { data, total } = await response.json();
Understanding the request
fetch() sends an HTTP request to the API.
response represents the HTTP response received from the API.
response.json() parses the JSON response body into a JavaScript object.
Finally, data contains the documents and total indicates the total number of results.