- Building a Web Application with Go, following the REST API design.
- The Clean Architecture approach in building the structure of an application. Dependency injection technique.
- Working with the gorilla/mux.framework.
- Working with Postgres database. Run from Docker. Generation of migration files.
- Working with the database using the sqlx library.
- Writing SQL queries.
- go 1.20
- docker & docker-compose
Definition migrating to database
migrate -path ./schema -database 'postgres://postgres:qwerty@localhost:5436/postgres?sslmode=disable' up
Use make run
to build&run project
Creates new user
{
"name": "user",
"email": "user@user.com",
"password": "password"
}
Request to get JWT Token based on user credentials
{
"email": "user@user.com",
"password": "password"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzEwMzgyMjQuNzQ0MzI0MiwidXNlciI6eyJJRCI6IjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCIsIlVzZXJuYW1lIjoiemhhc2hrZXZ5Y2giLCJQYXNzd29yZCI6IjQyODYwMTc5ZmFiMTQ2YzZiZDAyNjlkMDViZTM0ZWNmYmY5Zjk3YjUifX0.3dsyKJQ-HZJxdvBMui0Mzgw6yb6If9aB8imGhxMOjsk"
}
Creates new musics
{
"name": "Good Morning",
"artist": "Kanye West",
"album": "Graduation",
"genre": "Hip hop",
"released_year": 2007
}
Returns music by id
{
"name": "Good Morning",
"artist": "Kanye West",
"album": "Graduation",
"genre": "Hip hop",
"released_year": 2007
}
Deletes music by ID:
{
"id": "1"
}