在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:elm/http开源软件地址:https://github.com/elm/http开源编程语言:Elm 85.5%开源软件介绍:HTTPMake HTTP requests in Elm. Talk to servers. I very highly recommend reading through The Official Guide to understand how to use this package! ExamplesHere 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! |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论