Creating a RESTful API with Golang

Bharti T.
2 min readFeb 11, 2021

This article is talks about creating a fully-fledged REST API using Golang. This REST API exposes GET, POST, DELETE and PUT endpoints perform the full range of CRUD operations.

Before we move on, we need to define the structure of our ‘Article’. Go uses the concept of structs for the same.

Let’s now update our main function so that our Articles variable is populated with some dummy data that we can retrieve and modify using CRUD operations later.

CRUD OPERATIONS:

  1. Get all records

2. Get record by ID

3. Post a new record

4. Update a record

5. Delete a record

Using Postman HTTP client we can send HTTP requests and receive HTTP responses in JSON/XML format for the given API;

  1. Get all records

2. Get record by ID

3. Post a new record

4. Update a record

5. Delete a record

Hurrah! It’s DONE !

--

--