readinglist

module
v0.0.0-...-aa5133b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2023 License: MIT

README

Reading List

Go Report Card codecov

The "Reading List" project is an example HTTP REST API written in Go, following a microservices architecture. It utilizes RPC for communication between microservices.

Run With Docker Compose

To run the services use the following command:

docker-compose up

To stop the services use the following command

docker-compose down

API Endpoints

Signup

Request:

curl --location 'http://localhost:8080/auth/signup' \
--header 'Content-Type: application/json' \
--data '{
    "Username": "username_1",
    "Password": "password_1"
}'

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id":1
}

Login

Request:

curl --location 'http://localhost:8080/auth/login' \
--header 'Content-Type: application/json' \
--data '{
    "Username": username_1
    "Password": "password_1"
}'

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "token":"token_1"
}

Logout

Request:

curl --location --request POST 'http://localhost:8080/auth/logout' \
--header 'Username: username_1' \
--header 'Token: token_1'

Respomse:

HTTP/1.1 204 No Content

Validate

Request:

curl --location --request POST 'http://localhost:8080/auth/validate' \
--header 'Username: username_1' \
--header 'Token: token_1'

Response:

HTTP/1.1 204 No Content

Add Book

Request:

curl --location 'http://localhost:8080/books' \
--header 'Content-Type: application/json' \
--header 'Username: username_1' \
--header 'Token: token_1' \
--data '{
    "Title": "title_1",
    "Author": "author_1"
}'

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id":1
}

List Books

Request:

curl --location 'http://localhost:8080/books' \
--header 'Username: username_1' \
--header 'Token: token_1'

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "books": [
        {
            "ID": 1,
            "Title": "title_1",
            "Author": "author_1"
        }
    ]
}

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL