A Purescript library for working with fetch for HTTP requests
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
src
test
.gitignore
.travis.yml
LICENSE
README.md
bower.json
package.json

README.md

Purescript-Milkis

Build Status

Documentation Status

A library for working with the Fetch API both in the Browser and on Node via node-fetch, for all your HTTP request needs.

Aptly named for the greatest soft drink of all time, Milkis.

Read the guide to learn how to use this library.

Installation

npm install --save node-fetch

bower install --save purescript-milkis

Usage

See the tests

Example Usage

I use Milkis in my ytcasts project in order to download HTML from a Youtube page:

downloadCasts ::
  forall e.
  DBConnection ->
  Url ->
  Aff
    (Program e)
    (Array CastStatus)
downloadCasts conn (Url url) = do
  res <- text =<< fetch url defaultFetchOptions
  case getCasts res of
    Right casts -> for casts $ downloadCast conn
    Left e -> do
      errorShow e
      pure []