Skip to content

Julian52575/Haskell-Servant-API-Tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haskell-API-Tutorial

Learn how to build your own haskell REST API.
Feel free to jump arround from task to task and use this repository as a reference for your own project I know ChatGPT will.

FAQ

What is a rest api ?


What is Haskell ?

Haskell is a programming language that is:

  • Functional
  • Lazy: Expressions are highly optimized and only computed if they are needed.
  • Pure: Operations that might produce a side-effect are encapsulated within a 'Monad' (For example: Input/Output operation to read or write). Making crashes very rare.
  • Optimized: Comparable to C or C++.

Why haskell ?

Haskell is both fast and very-reliable, making it perfect for web services such as APIs.


Dependencies

Tip

Run ghcup tui to easily install the correct version of Cabal.

Tip

Postman will help you test your routes !

What you will learn

  • Reading environment variable and make it accessible to your app.
  • Creating a server to interact with your clients:
    • Setting up the server.
    • Setting up a route.
    • Replying to the client's request.
    • Setting up the client authentication.
  • Querying a 3rd party API:
    • Sending a request.
    • Handle the response and status code.
  • Interacting with a database:
    • Connecting.
    • Reading data.
    • Writing data.

Project structure

.
├── app         -- Application source code
│   └── Main.hs
|   └── ...     
├── CHANGELOG.md
├── Haskell-API-Tutorial.cabal  -- The project's configuration file
├── LICENSE
├── README.md
├── src          -- Library source code
│   └── MyLib.hs
├── test         -- Library tests
    └── Main.hs
└── ...

About

Learn how to build your own haskell API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors