Vanilla JS

How to use it JavaScript.

We have this page:

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ShapeRQ</title>
</head>
<body>
    <div id="getData"></div>
    <div id="output"></div>
</body>
</html>

And, we need to got some cheese for this page.

What about it?

cheese.js
import { httpGet, createConfig } from "shape-rq";

createConfig({
  APIs: { cheese: { baseUrl: "https://cheese-api.onrender.com" } },
  lang: "en",
});

document.getElementById("getData").onclick = async () => {
  const res = await httpGet("cheese", "/cheeses");
  if (!res) return alert("No cheese :(");
  document.getElementById("output").textContent = JSON.stringify(res);
};

Last updated