/rest-to-do

Todo List REST API in Haskell

Primary LanguageHaskellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Todo List REST API in Haskell

Project made with purpose of learning Haskell usage as server-side language.

Description

REST API with basic CRUD actions on todo list

How to run localy?

Download or clone master branch. In the root project directory run:

stack build --exec to-do-app-exe

Server will run on:

http://localhost:8080/

and you are ready to "hit" some endpoints.

Here are some curl examples:

  1. Get the whole todo list:
    curl --location --request GET 'http://localhost:8080/todos'
  1. Add a new item to the list:
    curl --location --request POST 'http://localhost:8080/todos' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "dueBy": "2010/10/21 12:00:00",
        "priority": "Normal",
        "title": "Change16",
        "description": "description"
    }'
  1. Get a single list item by id:
    curl --location --request GET 'http://localhost:8080/todo/4'
  1. Edit an existing item to the list:
    curl --location --request POST 'http://localhost:8080/todo/4' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "mbTitle": "Change17"
    }'
  1. Delete single list item by id:
    curl --location --request DELETE 'http://localhost:8080/todo/6'