Skip to content

idkjs/bs-fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bs-fetcher

Mashup of bs-fetch and bs-node-fetch

All credit goes to those @glennsl and @arnarthor, see those repos for details.

BsNodeFetch

BsNodeFetch.re corresponds with the bs-node-fetch master branch.

Fetch

Fetch.re corresponds with the bs-fetch master branch.

FetchNext

FetchNext.re corresponds with the bs-fetch-next branch on bs-fetch.

bs-fetch is intended as a thin layer atop the JS API, upon which more high-level and idiomatic libraries can be made. Once such a library has been established, these bindings will likely be refactored to be even thinner.

Running Examples with Node.js polyfill

bs-fetch has a section explaining how to use that project on the server using isomorphic-fetch.

Example

Js.Promise.(
  Fetch.fetch("https://dog.ceo/api/breeds/image/random/5")
  |> then_(Fetch.Response.text)
  |> then_(text => print_endline(text) |> resolve)
);

Installation

npm install --save https://github.com/idkjs/bs-fetcher

Then add bs-fetcher to bs-dependencies in your bsconfig.json:

{
  ...
  "bs-dependencies": ["bs-fetcher"]
}

method_ or _method

Converting the bs-fetch files to reason only seem to work if you use _method signature to deal with the resevered method keyword in bucklescript. In OCaml syntax, method_ works.

Releases

No releases published

Packages

No packages published