From 4a6aedf88ae5a5bf8f5d2d0b49165925320d8597 Mon Sep 17 00:00:00 2001 From: Chris Done Date: Mon, 11 Nov 2019 13:46:27 +0100 Subject: [PATCH] Add Getting Started to READMEs * Adds to the README seen on Github. * Adds to the README that will be seen on Stackage/Hackage. --- README.md | 30 ++++++++++++++++++++++++++++++ yesod/README.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/README.md b/README.md index 92aa8ca7..fb6ae54c 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,41 @@ An advanced web framework using the Haskell programming language. Featuring: * asynchronous IO * this is built in to the Haskell programming language (like Erlang) +## Getting Started + Learn more about Yesod on [its main website](http://www.yesodweb.com/). If you want to get started using Yesod, we strongly recommend the [quick start guide](http://www.yesodweb.com/page/quickstart), based on [the Haskell build tool stack](https://github.com/commercialhaskell/stack#readme). +Here's a minimal example! + +```haskell +{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-} + +import Yesod + +data App = App -- Put your config, database connection pool, etc. in here. + +-- Derive routes and instances for App. +mkYesod "App" [parseRoutes| +/ HomeR GET +|] + +instance Yesod App -- Methods in here can be overridden as needed. + +-- The handler for the GET request at /, corresponds to HomeR. +getHomeR :: Handler Html +getHomeR = defaultLayout [whamlet|Hello World!|] + +main :: IO () +main = warp 3000 App +``` + +To read about each of the concepts in use above (routing, handlers, +linking, JSON), in detail, visit +[Basics in the Yesod book](https://www.yesodweb.com/book/basics#basics_routing). + ## Hacking on Yesod Yesod consists mostly of four repositories: diff --git a/yesod/README.md b/yesod/README.md index b46f960c..fa49912b 100644 --- a/yesod/README.md +++ b/yesod/README.md @@ -8,3 +8,38 @@ the core code lives in For the yesod executable, see [yesod-bin](http://www.stackage.org/package/yesod-bin/). Yesod is [fully documented on its website](http://www.yesodweb.com/). + +## Getting Started + +Learn more about Yesod on [its main website](http://www.yesodweb.com/). If you +want to get started using Yesod, we strongly recommend the [quick start +guide](http://www.yesodweb.com/page/quickstart), based on [the Haskell build +tool stack](https://github.com/commercialhaskell/stack#readme). + +Here's a minimal example! + +```haskell +{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-} + +import Yesod + +data App = App -- Put your config, database connection pool, etc. in here. + +-- Derive routes and instances for App. +mkYesod "App" [parseRoutes| +/ HomeR GET +|] + +instance Yesod App -- Methods in here can be overridden as needed. + +-- The handler for the GET request at /, corresponds to HomeR. +getHomeR :: Handler Html +getHomeR = defaultLayout [whamlet|Hello World!|] + +main :: IO () +main = warp 3000 App +``` + +To read about each of the concepts in use above (routing, handlers, +linking, JSON), in detail, visit +[Basics in the Yesod book](https://www.yesodweb.com/book/basics#basics_routing).