choonkeat/create-elm-server/1.0.0

NOTE: the latest version is 1.0.1

Renamed to choonkeat/elm-webapp. It is published under that name, and new versions come out there.

Versions published as choonkeat/create-elm-server still install under that name. 2 versions of 2 come from the new location (see their notes).

Rerouted (cache, verified). The original is gone. This copy comes from a Lamdera package cache made before it went. The Lamdera package server serves a copy recovered from a Lamdera package cache from 2021-02-13.

What we checked: Rebuilt from the unpacked sources in a Lamdera package cache (5 copies agree), which Elm only writes after the published SHA-1 checked out; elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, so its SHA-1 is not the published one.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/choonkeat/create-elm-server/zipball/1.0.0/

Fullstack

A setup for writing http based, client-server app in elm, inspired wholly by Lamdera

Getting started

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-in sendToServer Task

    To 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 to sendToServer

  • 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 in src/Types.elm. See notes regarding imported types.

License

Copyright © 2020 Chew Choon Keat

Distributed under the MIT license.