Skip to content

Commit 41b08b6

Browse files
authored
Update faq.md
1 parent 65e0ce2 commit 41b08b6

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/extra/faq.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,36 @@ app.Use(func(c *fiber.Ctx) error {
3030
})
3131
```
3232

33+
## How can i use live reload ?
34+
35+
[Air](https://github.com/cosmtrek/air) is a handy tool that automatically restarts your Go applications whenever the source code changes, making your development process faster and more efficient.
36+
37+
To use Air in a Fiber project, follow these steps:
38+
39+
1. Install Air by downloading the appropriate binary for your operating system from the GitHub release page or by building the tool directly from source.
40+
2. Create a configuration file for Air in your project directory. This file can be named, for example, .air.toml or air.conf. Here's a sample configuration file that works with Fiber:
41+
```toml
42+
# .air.toml
43+
root = "."
44+
tmp_dir = "tmp"
45+
[build]
46+
cmd = "go build -o ./tmp/main ."
47+
bin = "./tmp/main"
48+
delay = 1000 # ms
49+
exclude_dir = ["assets", "tmp", "vendor"]
50+
include_ext = ["go", "tpl", "tmpl", "html"]
51+
exclude_regex = ["_test\\.go"]
52+
```
53+
3. Start your Fiber application using Air by running the following command in the terminal:
54+
```sh
55+
air
56+
```
57+
58+
As you make changes to your source code, Air will detect them and automatically restart the application.
59+
60+
A complete example demonstrating the use of Air with Fiber can be found in the [Fiber Recipes repository](https://github.com/gofiber/recipes/tree/master/air). This example shows how to configure and use Air in a Fiber project to create an efficient development environment.
61+
62+
3363
## How do I set up an error handler?
3464

3565
To override the default error handler, you can override the default when providing a [Config](../api/fiber.md#config) when initiating a new [Fiber instance](../api/fiber.md#new).

0 commit comments

Comments
 (0)