mirror of https://github.com/gofiber/fiber.git
Update README.md
parent
c79c3a35b6
commit
93b7792701
|
@ -201,30 +201,6 @@ 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>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
|
@ -287,6 +263,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))
|
||||
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### Cross-Origin Resource Sharing (CORS)
|
||||
|
||||
[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own.
|
||||
|
|
Loading…
Reference in New Issue