Implement an Elm client for a GraphQL Forum
Using elm-graphql and elm-ui to rapidly build a webapp for our GraphQL Forum.
Using elm-graphql and elm-ui to rapidly build a webapp for our GraphQL Forum.
@knewter
Elm is easily my favorite language for building webapps. I'd love to show you how to use Elm to build a Single Page App that interacts with our GraphQL backend.
I'm assuming you've already installed Elm 0.19 . We'll begin by making a new project:
mkdir firestorm_elm cd firestorm_elm elm init
This produces an
elm.json
file for us. Next, we need a basic application shell. We'll create that in
src/Main.elm
:
-- src/Main.elm module Main exposing (main) import Browser import Browser.Navigation as Nav import Html as H import Json.Decode import Url exposing (Url) main = Browser.application { init = init , view = view , update = update , subscriptions = subscriptions , onUrlRequest = onUrlRequest , onUrlChange = onUrlChange } type alias Model = {} type Msg = NoOp subscriptions = always Sub.none onUrlRequest = always NoOp onUrlChange = always NoOp view : model -> Browser.Document Msg view model = { title = "Forums" , body = [ H.text "Forums" ] }...
To see the complete version of this and more awesome lesson
become a superuser
Comments for Implement an Elm client for a GraphQL Forum