• This repository has been archived on 04/Sep/2023
  • Stars
    star
    4
  • Rank 3,304,323 (Top 66 %)
  • Language
    Scala
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An example project using Iron & Cats

Project example using Iron and Cats

This is an example project featuring Cats (via Http4s + Circe) and Iron.

This project is a minimal REST API to show the synergy between Iron and Cats.

Test the project

You can run this example using Mill:

millw main.run

Once the server started, you can send a POST request to localhost:8080/register with an Account-like JSON body:

{
  "username": "Iltotore",
  "email": "[email protected]",
  "password": "Abc123"
}
  • username should be alphanumeric
  • email should be a valid (existing or not) email
  • password should contain at least an upper, a lower and a number

You will receive a JSON response depending on the validity of your values.

If valid
{
  "Valid": {
    "username": "Iltotore",
    "email": "[email protected]",
    "password": "Abc123"
  }
}
If invalid (bad password and email)

Original request:

{
  "username": "Iltotore",
  "email": "memyemail.com",
  "password": "abc123"
}

Response:

{
  "Invalid": [
    {
      "name": "email",
      "message": "Value should be an email"
    },
    {
      "name": "password",
      "message": "Value should contain at least an upper, a lower and a number"
    }
  ]
}