DEV Community

Cover image for Fiber web and Go
natamacm
natamacm

Posted on

Fiber web and Go

#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:

Top comments (0)