Building Golang Rest API With Fiber & Gorm in 5 days — Day 1 Go Fiber Introduction

VANDY AHMAD MISRY AR RAZY
2 min readDec 17, 2021
Go Language

What Is Golang?

Go, also known as Golang, is an open-source, compiled, and statically typed programming language designed by Google. It is built to be simple, high-performing, readable, and efficient.

Go has been around for more than a decade now. It is super loved and super fun to learn and work with. Full stack web applications can be built using Go, but for this article, we will learn to build Rest API with go and fiber framework.

What Is Fiber And Why Do We Use Fiber?

Fiber is a Go web framework built on top of Fasthttp, the fastest HTTP engine for Go. It’s designed to ease things up for fast development with zero memory allocation and performance in mind.

Fiber is a web framework for Go with APIs readiness from scratch, middleware support and super fast performance.

Setup Enviroment

  1. To start the golang project, we can use go mod init in the terminal followed by the name of the module that will be used

go mod init gofiber

2. After that we need to install gofiber we can install the required depedency with the command go get

go get -u github.com/gofiber/fiber/v2

3. Next create a file with the name main.go , this file will be read first when the application run. Right now, we will just be initializing a fiber app inside here.

https://gist.github.com/vandyahmad24/a6f10e559119ad716c17aab9ee95b78f.js

Run the server by running

go run main.go

in the root directory. Then open postman or insomia (in this articel use insomia)go to localhost:4000. You will see a page like this

Insomia then hit localhost:4000

--

--