Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add route naming feature. #1650

Merged
merged 6 commits into from Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/README.md
Expand Up @@ -191,6 +191,36 @@ func main() {

```

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)

```go
Expand Down
30 changes: 30 additions & 0 deletions .github/README_de.md
Expand Up @@ -189,6 +189,36 @@ func main() {

```

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)

```go
Expand Down
30 changes: 30 additions & 0 deletions .github/README_es.md
Expand Up @@ -189,6 +189,36 @@ func main() {

```

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

#### 📖 [**Sirviendo Archivos Estáticos**](https://docs.gofiber.io/api/app#static)

```go
Expand Down
35 changes: 35 additions & 0 deletions .github/README_fa.md
Expand Up @@ -240,6 +240,41 @@ func main() {

</div>

<div dir="ltr" >

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

</div>


#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)

<div dir="ltr">
Expand Down
30 changes: 30 additions & 0 deletions .github/README_fr.md
Expand Up @@ -191,6 +191,36 @@ func main() {

```

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)

```go
Expand Down
34 changes: 34 additions & 0 deletions .github/README_he.md
Expand Up @@ -246,6 +246,40 @@ func main() {

<div dir="rtl">

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

</div>

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

<div dir="rtl">

#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)

</div>
Expand Down
30 changes: 30 additions & 0 deletions .github/README_id.md
Expand Up @@ -191,6 +191,36 @@ func main() {

```

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

#### 📖 [**Serving File Static**](https://docs.gofiber.io/api/app#static)

```go
Expand Down
30 changes: 30 additions & 0 deletions .github/README_it.md
Expand Up @@ -190,6 +190,36 @@ func main() {

```

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

#### 📖 [**Servire File Statici**](https://docs.gofiber.io/api/app#static)

```go
Expand Down
30 changes: 30 additions & 0 deletions .github/README_ja.md
Expand Up @@ -194,6 +194,36 @@ func main() {

```

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

#### 📖 [**静的ファイルの提供**](https://docs.gofiber.io/api/app#static)

```go
Expand Down
30 changes: 30 additions & 0 deletions .github/README_ko.md
Expand Up @@ -195,6 +195,36 @@ func main() {

```

#### 📖 [**Route Naming**](https://docs.gofiber.io/api/app#name)

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

// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) error {
msg := fmt.Sprintf("✋ %s", c.Params("*"))
return c.SendString(msg) // => ✋ register
}).Name("api")

data, _ := json.MarshalIndent(app.GetRoute("api"), "", " ")
fmt.Print(string(data))
// Prints:
// {
// "method": "GET",
// "name": "api",
// "path": "/api/*",
// "params": [
// "*1"
// ]
// }


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

```

#### 📖 [**Serving Static Files**](https://docs.gofiber.io/api/app#static)

```go
Expand Down