No description
Find a file
2015-03-23 18:34:47 -04:00
src Rename Command to Task 2015-03-16 12:20:52 -04:00
elm-package.json Add "elm-version" constraint 2015-03-23 18:34:47 -04:00
LICENSE Check in initial draft of elm-http 2015-03-08 15:36:39 -05:00
README.md Add a basic README 2015-03-09 17:47:02 -05:00

elm-http

Make HTTP requests in Elm.

The Http module aims to cover some of the most common cases of requesting JSON data, but also have lower-level functions such that the API covers all of the underlying functionality.

Example

import Http
import JavaScript.Decoder as JS exposing ((:=))
import Promise exposing (..)


lookupZipCode : String -> Promise Http.Error (List String)
lookupZipCode query =
    Http.get places ("http://api.zippopotam.us/us/" ++ query)


places : JS.Decoder (List String)
places =
  let place =
        JS.object2 (\city state -> city ++ ", " ++ state)
          ("place name" := JS.string)
          ("state" := JS.string)
  in
      "places" := JS.list place