elm-spa/README.md

53 lines
1.0 KiB
Markdown
Raw Normal View History

2019-10-05 01:16:02 +03:00
# ryannhg/elm-app
2019-10-16 07:52:54 +03:00
> an experiment for creating single page apps with Elm!
2019-10-05 01:16:02 +03:00
2019-10-08 08:22:17 +03:00
2019-10-16 07:52:54 +03:00
### try it out
2019-10-05 01:16:02 +03:00
2019-10-16 07:52:54 +03:00
1. `npm install`
2019-10-05 01:16:02 +03:00
2019-10-16 07:52:54 +03:00
1. `npm run dev`
2019-10-05 01:16:02 +03:00
2019-10-16 07:52:54 +03:00
### overview
2019-10-05 01:16:02 +03:00
2019-10-08 08:22:17 +03:00
```elm
module Main exposing (main)
2019-10-05 01:16:02 +03:00
2019-10-16 07:52:54 +03:00
import Application exposing (Application)
import Generated.Pages as Pages
import Generated.Route as Route
import Layout as Layout
2019-10-05 01:16:02 +03:00
2019-10-08 08:22:17 +03:00
2019-10-16 07:52:54 +03:00
main : Application () Pages.Model Pages.Msg
2019-10-08 08:22:17 +03:00
main =
2019-10-16 07:52:54 +03:00
Application.create
{ routing =
{ fromUrl = Route.fromUrl
, toPath = Route.toPath
}
, layout =
{ view = Layout.view
}
, pages =
{ init = Pages.init
, update = Pages.update
, bundle = Pages.bundle
}
2019-10-08 23:06:03 +03:00
}
```
2019-10-16 07:52:54 +03:00
#### supporting code
2019-10-08 23:06:03 +03:00
2019-10-16 07:52:54 +03:00
- [`Generated.Route`](./src/Generated/Route.elm)
2019-10-08 23:06:03 +03:00
2019-10-16 07:52:54 +03:00
- [`Generated.Pages`](./src/Generated/Pages.elm)
2019-10-08 23:06:03 +03:00
2019-10-16 07:52:54 +03:00
- [`Layout`](./src/Layout.elm)
2019-10-08 23:06:03 +03:00
2019-10-16 07:52:54 +03:00
- [`Pages.Homepage`](./src/Pages/Homepage.elm) (a static page)
2019-10-08 23:06:03 +03:00
2019-10-16 07:52:54 +03:00
- [`Pages.Counter`](./src/Pages/Counter.elm) (a sandbox page)
2019-10-05 04:25:25 +03:00
2019-10-16 07:52:54 +03:00
- [`Pages.Random`](./src/Pages/Random.elm) (a static page)