Giter Club home page Giter Club logo

haskell-yesod-realworld-example-app's Introduction

RealWorld Example App

Built with Spacemacs Build Status

Haskell/Yesod codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

How it works

Check out this post for an overview of project's dependencies and its structure.

Getting started

Haskell Setup

  1. If you haven't already, install Stack
    • On POSIX systems, this is usually curl -sSL https://get.haskellstack.org/ | sh
  2. Install the yesod command line tool: stack install yesod-bin --install-ghc
  3. Build libraries: stack build

If you have trouble, refer to the Yesod Quickstart guide for additional detail.

Development

Start a development server with:

export JWT_SECRET="some secret value"
stack exec -- yesod devel

As your code changes, your site will be automatically be recompiled and redeployed to localhost.

Tests

stack test --flag app:library-only --flag app:dev

(Because yesod devel passes the library-only and dev flags, matching those flags means you don't need to recompile between tests and development, and it disables optimization to speed up your test compile times).

Documentation

  • Read the Yesod Book online for free
  • Check Stackage for documentation on the packages in your LTS Haskell version, or search it using Hoogle. Tip: Your LTS version is in your stack.yaml file.
  • For local documentation, use:
    • stack haddock --open to generate Haddock documentation for your dependencies, and open that documentation in a browser
    • stack hoogle <function, module or type signature> to generate a Hoogle database and search for your query
  • The Yesod cookbook has sample code for various needs

Getting Help

haskell-yesod-realworld-example-app's People

Contributors

alonski avatar ericsimons avatar esakkiraj avatar optikfluffel avatar tzemanovic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haskell-yesod-realworld-example-app's Issues

Better error reporting when `JWT_SECRET` is missing

I forgot to follow the full instructions and did not set JWT_SECRET and got an infinite loop when running Yesod and was mystified for a long time before I figured out it was because I did not set JWT_SECRET. Could this app check for the missing environment variable and report that?

$ stack exec -- yesod devel
...
Starting devel application
devel.hs: Could not convert to expected type: expected Text, encountered Null
CallStack (from HasCallStack):
  error, called at src/Data/Yaml/Config.hs:201:20 in yaml-0.11.0.0-GAWf3vpOhGMK7o9d6zMyJu:Data.Yaml.Config
Unexpected: child process exited with ExitFailure 1
Trying again
Starting devel application
devel.hs: Could not convert to expected type: expected Text, encountered Null
CallStack (from HasCallStack):
  error, called at src/Data/Yaml/Config.hs:201:20 in yaml-0.11.0.0-GAWf3vpOhGMK7o9d6zMyJu:Data.Yaml.Config
Unexpected: child process exited with ExitFailure 1
Trying again
Starting devel application
devel.hs: Could not convert to expected type: expected Text, encountered Null
CallStack (from HasCallStack):
  error, called at src/Data/Yaml/Config.hs:201:20 in yaml-0.11.0.0-GAWf3vpOhGMK7o9d6zMyJu:Data.Yaml.Config
Unexpected: child process exited with ExitFailure 1
Trying again

Set the "JWT_SECRET" environment variable

Hitting this error:

> export JWT_SECRET="some secret value"
> yesod devel
Success! Waiting for next file change.
Type help for available commands. Press enter to force a rebuild.
Starting devel application
devel.hs: Set the "JWT_SECRET" environment variable
Unexpected: child process exited with ExitFailure 1

If relevant, I did slightly modify the stack.yaml for use with Nix:

resolver: lts-14.25
packages:
- .
extra-deps:
- esqueleto-2.6.0
- jwt-0.9.0

install-ghc: false
system-ghc: true

nix:
  enable: true
  packages: [glpk, pcre, zlib]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.