• Stars
    star
    155
  • Rank 240,864 (Top 5 %)
  • Language
    Elm
  • License
    BSD 3-Clause "New...
  • Created about 8 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Make HTTP requests in Elm

HTTP

Make HTTP requests in Elm. Talk to servers.

I very highly recommend reading through The Official Guide to understand how to use this package!

Examples

Here are some commands you might create to send HTTP requests with this package:

import Http
import Json.Decode as D

type Msg
  = GotBook (Result Http.Error String)
  | GotItems (Result Http.Error (List String))

getBook : Cmd Msg
getBook =
  Http.get
    { url = "https://elm-lang.org/assets/public-opinion.txt"
    , expect = Http.expectString GotBook
    }

fetchItems : Cmd Msg
fetchItems =
  Http.post
    { url = "https://example.com/items.json"
    , body = Http.emptyBody
    , expect = Http.expectJson GotItems (D.list (D.field "name" D.string))
    }

But again, to really understand what is going on here, read through The Official Guide. It has sections describing how HTTP works and how to use it with JSON data. Reading through will take less time overall than trying to figure everything out by trial and error!

More Repositories

1

compiler

Compiler for Elm, a functional language for reliable webapps.
Haskell
7,493
star
2

core

Elm's core libraries
Elm
2,791
star
3

elm-lang.org

Server and client code for the Elm website.
Elm
1,987
star
4

projects

Curated collection of projects for folks looking to collaborate within the Elm ecosystem.
423
star
5

html

Use HTML in Elm!
Elm
395
star
6

browser

Create Elm programs that run in browsers!
Elm
311
star
7

package.elm-lang.org

website for browsing packages and exploring documentation
Haskell
293
star
8

parser

A parsing library, focused on simplicity and great error messages
Elm
226
star
9

virtual-dom

The foundation of HTML and SVG in Elm.
JavaScript
208
star
10

error-message-catalog

A catalog of broken Elm programs / data to improve error messages
Elm
173
star
11

svg

Fast SVG in Elm
Elm
146
star
12

file

Select files. Download files. Work with file content.
Elm
106
star
13

time

A simplified approach to working with dates, times, and time zones.
Elm
92
star
14

json

Work with JSON in Elm
Elm
90
star
15

bytes

Work with bytes and implement network protocols
Elm
80
star
16

url

Build and parse URLs. Useful for HTTP and "routing" in single-page apps (SPAs)
Elm
75
star
17

expectations

Trying to set expectations about @elm processes
53
star
18

editor-plugins

List of editor plugins for Elm.
50
star
19

random

Generate random values in Elm
Elm
45
star
20

regex

If you really need regex in Elm, it is possible.
Elm
33
star
21

color

Standard representation of colors, encouraging sharing between packages.
Elm
24
star
22

foundation.elm-lang.org

Source code for the ESF website
Elm
17
star
23

project-metadata-utils

Work with elm.json and docs.json files in Elm
Elm
16
star
24

forum-rules

Rules for Elm forums
9
star