Update README.md

pull/198/head
Vic Shóstak 2020-03-01 18:49:56 +03:00 committed by GitHub
parent ae028f5e3d
commit c79c3a35b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 2 deletions

28
.github/README.md vendored
View File

@ -201,6 +201,30 @@ func main() {
} }
``` ```
### Built-in logger
```go
import (
"github.com/gofiber/fiber"
"github.com/gofiber/fiber/middleware"
)
func main() {
app := fiber.New()
// If you want to change default Logger config
loggerConfig := middleware.LoggerConfig{
Format: "${time} - ${method} ${path}\n",
TimeFormat: "Mon, 2 Jan 2006 15:04:05 MST",
}
// Middleware for Logger with config
app.Use(middleware.Logger(loggerConfig))
// ...
}
```
<details> <details>
<summary>📚 Show more code examples</summary> <summary>📚 Show more code examples</summary>
@ -270,7 +294,7 @@ func main() {
```go ```go
import ( import (
"github.com/gofiber/fiber" "github.com/gofiber/fiber"
"github.com/gofiber/fiber/middleware" // all middleware are combined in a separate Go package "github.com/gofiber/fiber/middleware"
) )
func main() { func main() {
@ -290,7 +314,7 @@ func main() {
Check CORS by passing any domain in `Origin` header: Check CORS by passing any domain in `Origin` header:
```bash ```bash
curl -H "Origin: http://example.com" --verbose http://localhost:3000` curl -H "Origin: http://example.com" --verbose http://localhost:3000
``` ```
### Custom 404 response ### Custom 404 response