Conversation
Owner
devfeel
commented
Jan 3, 2019
- New Feature: HttpServer & Router add RegisterServerFile use to register ServerFile router with routeMethod method on http.FileServer
- Update: ServerFile add support for EnabledAutoHEAD\EnabledAutoOPTIONS
- Detail:
- when use ServerFile, default routeMethod is GET
- you can use RegisterServerFile specify other HttpMethod, like "POST"
- Example:
- How To:
- how to add support "HEAD" method for all requests in your httpserver?
- 2019-01-03 10:00
* New Feature: HttpServer & Router add RegisterServerFile use to register ServerFile router with routeMethod method on http.FileServer
* Update: ServerFile add support for EnabledAutoHEAD\EnabledAutoOPTIONS
* Detail:
- when use ServerFile, default routeMethod is GET
- you can use RegisterServerFile specify other HttpMethod, like "POST"
* Example:
``` golang
server.RegisterServerFile(dotweb.RouteMethod_POST, "/dst/*", "/home/www/")
```
* How To:
- how to add support "HEAD" method for all requests in your httpserver?
~~~go
func main() {
app := dotweb.Classic("/home/logs/wwwroot/")
// if use this, all router will auto add "HEAD" method support
// default is false
app.HttpServer.SetEnabledAutoHEAD(true)
app.HttpServer.GET("/index", func(ctx dotweb.Context) error{
return ctx.WriteString("welcome to my first web!")
})
err := app.StartServer(80)
fmt.Println("dotweb.StartServer error => ", err)
}
~~~
* 2019-01-03 10:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.