A set of REST endpoints for integration with ReqRes.in using http4s, doobie and PostgreSQL.
- Endpoint that allows to get a user data from ReqRes.in
(example: https://reqres.in/api/users/12) and persist user's
id
,first_name
,last_name
to the local database. An extra parameteremail
is used as a unique key for theuser
table.
POST /users
{
"email": <string>,
"user_id": <int>
}
where
email
- unique key for user identification in the local databaseuser_id
- user identifier in ReqRes.in
- Endpoint that allows to get a user data from the database.
GET /users/{email}
{
"email": <string>,
"id": <int>,
"first_name": <string>,
"last_name": <string>
}
- Endpoint that allows to delete a user data from the local database.
DELETE /users/{email}
- All errors should have following format:
{ "message": <string> }
To run the application:
sbt run
It will be listening on port 8080 by default. All settings are located in
src/main/resources/application.conf
. Don't forget to configure access to a
PostgreSQL instance.
To run end-to-end tests execute e2e-tests.sh
script.