A setup for writing http based, client-server app in elm, inspired wholly by Lamdera
npx create-elm-server element hello-app
This will create a skeleton file directory structure
hello-app
├── Makefile
├── index.js
└── src
├── Client.elm
├── Server.elm
├── Types.elm
└── Types
└── Auto.elm
1 directory, 5 files
-
src/Client.elm
is where our Browser.element resides. The only exception is, this app includes a built-insendToServer
TaskTo generate Browser.document or Browser.application instead, use either commands
npx create-elm-server document hello-app npx create-elm-server application hello-app
-
src/Server.elm
is where our elm Platform.worker resides. It serves your SPA by default, and can respond tosendToServer
-
src/Types.elm
includes the custom types that defines the protocol between Client and Server -
index.js
boots up our Server.elm and listens to http requests at port 8000 -
src/Types.elm
holds the types shared between Server and Client. -
src/Types/Auto.elm
contains auto-generated Json Encoder and Decoder for all types defined insrc/Types.elm
. See notes regarding imported types.
Copyright © 2020 Chew Choon Keat
Distributed under the MIT license.