go

Fiber web and Go

natamacm

natamacm

Posted on May 6, 2020

Fiber web and Go

Fiber is an Express inspired web framework written in Go. You need Go 1.11 or higher to work with Fiber.

You should learn Go before playing with Fiber, because the way things work in Go are a bit different than Python or PHP.

It supports routing, static files and a lot of middle ware. Here is a list of features:

  • Robust routing
  • Serve static files
  • Extreme performance
  • Low memory footprint
  • API endpoints
  • Middleware & Next support
  • Rapid server-side programming
  • Template engines
  • WebSocket support
  • Rate Limiter

You can install it with the go get command:

go get -u github.com/gofiber/fiber

Then this would be a simple hello world program:

    package main

    import "github.com/gofiber/fiber"

    func main() {
       app := fiber.New()

       app.Get("/", func(c *fiber.Ctx) {
         c.Send("Hello, World!")
       })

       app.Listen(3000)
     }

If you then open your localhost:3000 in the web browser and open the url, it will show:

Hello, World!

Fiber is built on top of Fasthttp, the fastest HTTP engine for Go. It's designed to ease things up for fast development: zero memory allocation.

Related links:

💖 💪 🙅 🚩
natamacm
natamacm

Posted on May 6, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024

How to Use KitOps with MLflow
beginners How to Use KitOps with MLflow

November 29, 2024