Getting started with Fiber
Tags: fiber, go, express, tutorial
Published: 2020-10-05 03:29:04

New gophers that make the switch from [Node.js](https://nodejs.org/en/about/) to [Go](https://golang.org/doc/) are dealing with a learning curve before they can start building their web applications or microservices. Fiber, as a **web framework**, was created with the idea of **minimalism** and follows the **UNIX way**, so that new gophers can quickly enter the world of Go with a warm and trusted welcome.

Fiber is **inspired** by Express, the most popular web framework on the Internet. We combined the **ease** of Express and **raw performance** of Go. If you have ever implemented a web application in Node.js (_using Express or similar_), then many methods and principles will seem **very common** to you.

We **listen** to our users in [issues](https://github.com/gofiber/fiber/issues), Discord [channel](https://gofiber.io/discord) _and all over the Internet_ to create a **fast**, **flexible** and **friendly** Go web framework for **any** task, **deadline** and developer **skillset**! Just like Express does in the JavaScript world.

## **Step 1: Install Go**

You can get the latest version of Go from [the official Golang website](https://golang.org/dl/) follow the instructions and you're good to go, make sure you install Go **1.14** or higher.

![](https://i.imgur.com/W0uDvY5.png)

To confirm you have Go installed open your terminal or command prompt and run the following command: 

```cmd
> go version
go version go1.15 windows/amd64
```

You should get the version number of your Go installation.


## **Step 2: Creating your first project**

In your project directory, we want to create a **[go.mod](https://blog.golang.org/using-go-modules)** to manage our dependencies. Type the following:

```cmd
> go mod init demo
go: creating new go.mod: module demo
```

Now create a file called **main.go** in the project directory write the following code in it:

```go
package main

import (
	"log"

	"github.com/gofiber/fiber/v2"
)

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

	app.Get("/", func(c *fiber.Ctx) error {
		return c.SendString("Hello, World 👋!")
	})

	log.Fatal(app.Listen(":3000"))
}
```

The above code is actually the bare-bones to get the server respond with a _Hello, World 👋!_

Save the file and run the following command to update your `go.mod`

```cmd
> go mod tidy
go: finding module for package github.com/gofiber/fiber/v2
go: found github.com/gofiber/fiber/v2 in github.com/gofiber/fiber/v2 v2.0.5
```

This will create a `go.sum` file that ensures that future downloads of these modules retrieve the same bits as the first download, to ensure the modules your project depends on do not change unexpectedly, whether for malicious, accidental, or other reasons

Your project folder should contain the following file structure:

```cmd
/GettingStarted
   ├── main.go
   ├── go.mod
   └── go.sum
```

Let's launch our app by calling the following command:

```cmd
go run main.go
```

![](https://i.imgur.com/iG3qYQa.png)

Visit http://localhost:3000 in your browser. You will see the following:

![](https://i.imgur.com/XrFtCtv.png)

At this point, you have successfully set up your first Fiber application.


## **Step 3: Explore Fiber**

Fiber has a great community and online documentation that can help you creating fast and secure web apps.

- https://github.com/gofiber/fiber
- https://docs.gofiber.io/
- https://gofiber/discord

See ya 👋