OverviewThe following describes an example project that creates a REST API using Haskell as a GAE custom runtime component.
The component is built using Scotty a lightweight web framework and makes use of the Aeson library to marshal to and from Json.
The API describes a simple TODO application with a list of items held in memory and is an extension of work by Sean Hess.
All the code for the project may be found at: https://github.com/andywhardy/haskell-gae
- To run locally you must have Haskell and Stack installed on your operating system.
- To upload to GCP you must have editor rights to a GCP project and have the gcloud tool installed and available on your path.
For further information on installing Haskell or Stack for your OS please see: https://www.haskell.org/platform/ http://docs.haskellstack.org/en/stable/README.html The following may be useful info for setting up GCP: https://cloud.google.com/compute/docs/projects https://cloud.google.com/sdk/gcloud/
Clone project from git
git clone https://github.com/andywhardy/haskell-gae
cd haskell-gae stack setup
stack exec haskell-gae
http://localhost:8080/items http://localhost:8080/items/1 http://localhost:8080/items/2
gcloud preview app deploy --promote --version test-1 app.yaml