Skip to content

hubenokdev/go_web_service_gin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go_web_service_gin

An installation of Go 1.16 or later. For installation instructions, see Installing Go. A tool to edit your code. Any text editor you have will work fine. A command terminal. Go works well using any terminal on Linux and Mac, and on PowerShell or cmd in Windows. The curl tool. On Linux and Mac, this should already be installed. On Windows, it’s included on Windows 10 Insider build 17063 and later. For earlier Windows versions, you might need to install it. For more, see Tar and Curl Come to Windows.

Design API endpoints You’ll build an API that provides access to a store selling vintage recordings on vinyl. So you’ll need to provide endpoints through which a client can get and add albums for users.

When developing an API, you typically begin by designing the endpoints. Your API’s users will have more success if the endpoints are easy to understand.

Here are the endpoints you’ll create in this tutorial.

/albums

GET – Get a list of all albums, returned as JSON. POST – Add a new album from request data sent as JSON. /albums/:id

GET – Get an album by its ID, returning the album data as JSON. Next, you’ll create a folder for your code.

#command lines curl http://localhost:8080/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}'

curl http://localhost:8080/albums/2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages