Go to file
2023-05-02 00:36:18 +00:00
src „src/index.mjs“ ändern 2023-05-02 00:36:18 +00:00
LICENSE Initial commit 2019-11-25 14:58:15 +01:00
package.json update version to 1.0.1 2020-02-13 14:53:29 +01:00
README.md add readme 2019-11-25 15:17:26 +01:00

flumm-fetch

Usage Example

async / await

import fetch from "flumm-fetch";

// GET
(async () => {
  const query = await fetch("https://example.com/file.json");
  const result = await query.json();
  console.log(result);
})();

// POST
(async () => {
  const opts = {
    method: "POST",
    body: {
      name: "John Doe",
      password: "pwd"
    }
  };
  const query = await fetch("https://example.com/file.json", opts);
  const result = await query.json();
  console.log(result);
})();

promises

import fetch from "flumm-fetch";

// GET
fetch("https://google.de")
  .then(res => res.text())
  .then(res => console.log(res))
  .catch(console.error);

// POST
const opts = {
  method: "POST",
  body: {
    name: "John Doe",
    password: "pwd"
  }
};
fetch("https://google.de", opts)
  .then(res => res.text())
  .then(res => console.log(res))
  .catch(console.error);

License

This project is licensed under the MIT license, see LICENSE.