Skip to content

FNDenisovna/LearnApiGo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Учебный проект сервиса интеграции.

Приложение параллельного веб-сервиса, 
получает клиентские Rest/Grpc-запросы в необходимом формате JSON, 
обрабатывает по необходимой бизнес-логике, 
выполняет манипуляциии с БД, 
возвращает ответ в необходимом формате JSON.

##############################################################################################

#to generate swagger info and correct detected models
#run
PS D:\LearnApiGo> swag init -g internal/apis/endpoint.go

# GET "/albums" retrun all albums in db
curl http://localhost:8080/albums -X GET -H @{ "content-type" = "application/json"} 
curl.exe http://localhost:8080/albums -X GET -H "Content-Type: application/json"
#alternate command:
##Invoke-RestMethod -Uri http://localhost:18332/ -Credential bitcoinipvision -body $thisCanBeAPowerShellObject  

curl http://localhost:8080/albums \
    --header "Content-Type: application/json" \
    --request "GET"


# POST "/albums" add new row to albums
curl.exe -i -X POST -H "Content-Type: application/json" -d "@body.json" http://localhost:8080/api/v1/albums

curl http://localhost:8080/albums \
    --include \
    --header "Content-Type: application/json" \
    --request "POST" \
    --data '{"id": "4","title": "The Modern Sound of Betty Carter","artist": "Betty Carter","price": 49.99}'

#SWAGGER + пример подключения бд, авторизация
#https://github.com/MartinHeinz/go-project-blueprint/blob/rest-api/cmd/blueprint/main.go

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages