replace zxq.co/ripple/hanayo
This commit is contained in:
28
vendor/github.com/valyala/fasthttp/fs_example_test.go
generated
vendored
Normal file
28
vendor/github.com/valyala/fasthttp/fs_example_test.go
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
package fasthttp_test
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
func ExampleFS() {
|
||||
fs := &fasthttp.FS{
|
||||
// Path to directory to serve.
|
||||
Root: "/var/www/static-site",
|
||||
|
||||
// Generate index pages if client requests directory contents.
|
||||
GenerateIndexPages: true,
|
||||
|
||||
// Enable transparent compression to save network traffic.
|
||||
Compress: true,
|
||||
}
|
||||
|
||||
// Create request handler for serving static files.
|
||||
h := fs.NewRequestHandler()
|
||||
|
||||
// Start the server.
|
||||
if err := fasthttp.ListenAndServe(":8080", h); err != nil {
|
||||
log.Fatalf("error in ListenAndServe: %s", err)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user