mirror of
https://github.com/ryan-haskell/elm-spa.git
synced 2024-11-22 11:31:58 +03:00
Merge pull request #67 from erlandsona/master
Sorry if this is super boring but hoping it's helpful.
This commit is contained in:
commit
3e068adfce
@ -95,7 +95,7 @@ We'll cover this in more detail in the [routing section](./routing)
|
||||
|
||||
### using page templates
|
||||
|
||||
The `elm-spa add` command also accepts an optional `template` argument to for common
|
||||
The `elm-spa add` command also accepts an optional `template` argument too for common
|
||||
pages you might create.
|
||||
|
||||
```bash
|
||||
|
@ -73,7 +73,7 @@ This is less common than `req.params` and `req.query`, but can be useful for get
|
||||
|
||||
## Getting the current route
|
||||
|
||||
The `Request` type also has access to the `Route` value, so you can easily do comparisons agains the current route!
|
||||
The `Request` type also has access to the `Route` value, so you can easily do comparisons against the current route!
|
||||
|
||||
```elm
|
||||
-- "/"
|
||||
|
@ -15,14 +15,14 @@ URL | File
|
||||
In this section, we'll cover the 3 kinds of routes you can find in an __elm-spa__ application.
|
||||
|
||||
## The homepage
|
||||
|
||||
The `src/Pages/Home_.elm` file is a reserved page that handles requests to `/`. The easiest way to make a new homepage is with the [`add` command](/guide/cli#adding-a-homepage) covered in the CLI section:
|
||||
|
||||
The `src/Pages/Home_.elm` is a reserved filename that handles requests to /. The easiest way to make a new homepage is with the [`add` command](/guide/cli#adding-a-homepage) covered in the CLI section:
|
||||
|
||||
```terminal
|
||||
elm-spa add /
|
||||
```
|
||||
|
||||
__Note:__ Without the trailing underscore, __elm-spa__ will treat `Home.elm` as a route to `/home`! This is called a "static route", and will be covered at the end of this sentence.
|
||||
__Note:__ Without the trailing underscore, __elm-spa__ will treat `Home.elm` as a route to `/home`! This is called a "static route", and will be covered next.
|
||||
|
||||
## Static routes
|
||||
|
||||
@ -103,4 +103,4 @@ It will handle any request to `/users/___/posts/___`
|
||||
|
||||
If a user visits a URL that doesn't have a corresponding page, it will redirect to the `NotFound.elm` page. This is generated for you by default in the `.elm-spa/defaults/Pages` folder. When you are ready to customize it, move it into `src/Pages` and customize it like you would any other page!
|
||||
|
||||
In __elm-spa__, this technique is called "ejecting" a default file. Throughout the guide, we'll find more default files that we might want to control in our project.
|
||||
In __elm-spa__, this technique is called "ejecting" a default file. Throughout the guide, we'll find more default files that we might want to control in our project.
|
||||
|
Loading…
Reference in New Issue
Block a user