Query from a React app
Cube offers both REST and GraphQL APIs, which can be used to query data from applications built in React or other frontend frameworks. You can find your REST API endpoint on the Overview page. In development mode, Cube creates an isolated endpoint for testing data model changes without affecting production. The structure of your REST API endpoint in development mode should follow the format below.npm:
Next, initialize cubeApi within your application.
Please note that you must sign your request with the correct authentication
token. Cube uses the JSON Web Token (JWT) standard by default
to authenticate requests. You can copy a temporary token from the “How to
connect to your application” modal window. For production use, you must generate
this token from your secret key. You can learn more about this in the
Authentication & Authorization section of the documentation.
CubeProvider that can be used in your React
application.
useCubeQuery hook to load data from Cube into your
React application.