Skip to content

Commit 4a6aedf

Browse files
committed
Add Getting Started to READMEs
* Adds to the README seen on Github. * Adds to the README that will be seen on Stackage/Hackage.
1 parent 347ea67 commit 4a6aedf

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,41 @@ An advanced web framework using the Haskell programming language. Featuring:
1212
* asynchronous IO
1313
* this is built in to the Haskell programming language (like Erlang)
1414

15+
## Getting Started
16+
1517
Learn more about Yesod on [its main website](http://www.yesodweb.com/). If you
1618
want to get started using Yesod, we strongly recommend the [quick start
1719
guide](http://www.yesodweb.com/page/quickstart), based on [the Haskell build
1820
tool stack](https://github.com/commercialhaskell/stack#readme).
1921

22+
Here's a minimal example!
23+
24+
```haskell
25+
{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-}
26+
27+
import Yesod
28+
29+
data App = App -- Put your config, database connection pool, etc. in here.
30+
31+
-- Derive routes and instances for App.
32+
mkYesod "App" [parseRoutes|
33+
/ HomeR GET
34+
|]
35+
36+
instance Yesod App -- Methods in here can be overridden as needed.
37+
38+
-- The handler for the GET request at /, corresponds to HomeR.
39+
getHomeR :: Handler Html
40+
getHomeR = defaultLayout [whamlet|Hello World!|]
41+
42+
main :: IO ()
43+
main = warp 3000 App
44+
```
45+
46+
To read about each of the concepts in use above (routing, handlers,
47+
linking, JSON), in detail, visit
48+
[Basics in the Yesod book](https://www.yesodweb.com/book/basics#basics_routing).
49+
2050
## Hacking on Yesod
2151

2252
Yesod consists mostly of four repositories:

yesod/README.md

+35
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,38 @@ the core code lives in
88
For the yesod executable, see [yesod-bin](http://www.stackage.org/package/yesod-bin/).
99

1010
Yesod is [fully documented on its website](http://www.yesodweb.com/).
11+
12+
## Getting Started
13+
14+
Learn more about Yesod on [its main website](http://www.yesodweb.com/). If you
15+
want to get started using Yesod, we strongly recommend the [quick start
16+
guide](http://www.yesodweb.com/page/quickstart), based on [the Haskell build
17+
tool stack](https://github.com/commercialhaskell/stack#readme).
18+
19+
Here's a minimal example!
20+
21+
```haskell
22+
{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-}
23+
24+
import Yesod
25+
26+
data App = App -- Put your config, database connection pool, etc. in here.
27+
28+
-- Derive routes and instances for App.
29+
mkYesod "App" [parseRoutes|
30+
/ HomeR GET
31+
|]
32+
33+
instance Yesod App -- Methods in here can be overridden as needed.
34+
35+
-- The handler for the GET request at /, corresponds to HomeR.
36+
getHomeR :: Handler Html
37+
getHomeR = defaultLayout [whamlet|Hello World!|]
38+
39+
main :: IO ()
40+
main = warp 3000 App
41+
```
42+
43+
To read about each of the concepts in use above (routing, handlers,
44+
linking, JSON), in detail, visit
45+
[Basics in the Yesod book](https://www.yesodweb.com/book/basics#basics_routing).

0 commit comments

Comments
 (0)