The application implements a service for sending methods GET, POST, DELETE, PUT to interact with the database, which is described in this file. Additionally implemented authorization and authentication using jwt.
Creates new user
{
"username": "UncleBob",
"password": "cleanArch"
}
Request to get JWT Token based on user credentials
{
"username": "UncleBob",
"password": "cleanArch"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzEwMzgyMjQuNzQ0MzI0MiwidXNlciI6eyJJRCI6IjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCIsIlVzZXJuYW1lIjoiemhhc2hrZXZ5Y2giLCJQYXNzd29yZCI6IjQyODYwMTc5ZmFiMTQ2YzZiZDAyNjlkMDViZTM0ZWNmYmY5Zjk3YjUifX0.3dsyKJQ-HZJxdvBMui0Mzgw6yb6If9aB8imGhxMOjsk"
}
Creates new info
{
"first_name": "Marlon",
"last_name": "Brando",
"relationship": "istructor",
"phone": "+380000000000",
"date_of_birth": "03.04.1998",
"salary": 3000
}
{
"first_name": "Steven",
"last_name": "Jobs",
"relationship": "member",
"phone": "+380000000001",
"date_of_birth": "07.08.2000",
"membership_id": 1,
"expires_at": "16.11.2022"
}
Returns all user info
{
"info": [
{
"id": 1
"first_name": "Marlon",
"last_name": "Brando",
"middle_name": "",
"relationship": "istructor",
"phone": "+380000000000",
"date_of_birth": "03.04.1998",
"date_of_registry": "16.08.2022",
"hire_date": "16.08.2022",
"salary": 3000
}
]
}
Deletes info by ID:
{
"id": "1"
}
- go 1.18
- docker & docker-compose
- postman (for testing)
make build && make run
If the application is running for the first time, you need to apply migrations to the database:
make migrate
You can simply copy and paste the contents of the file in the terminal, opening the desired database.
If you're using Git Bash on Windows and don't have a make
command in the terminal, I recommend this guide.
The postman folder contains a collection for testing the application. Postman download link.
Inspired by Maksim Zhashkevych.