mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
137c41344d
Former-commit-id: 2791c50256c0f00d6e08a408e5cb009262c49588
68 lines
1.9 KiB
Go
68 lines
1.9 KiB
Go
package router
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func ExampleParty_StaticWeb() {
|
|
api := NewAPIBuilder()
|
|
api.StaticWeb("/static", "./assets")
|
|
|
|
err := api.GetReport()
|
|
if err == nil {
|
|
panic("expected report for deprecation")
|
|
}
|
|
|
|
fmt.Print(err)
|
|
// Output: StaticWeb is DEPRECATED and it will be removed eventually.
|
|
// Source: ./deprecated_example_test.go:9
|
|
// Use .HandleDir("/static", "./assets") instead.
|
|
}
|
|
|
|
func ExampleParty_StaticHandler() {
|
|
api := NewAPIBuilder()
|
|
api.StaticHandler("./assets", false, true)
|
|
|
|
err := api.GetReport()
|
|
if err == nil {
|
|
panic("expected report for deprecation")
|
|
}
|
|
|
|
fmt.Print(err)
|
|
// Output: StaticHandler is DEPRECATED and it will be removed eventually.
|
|
// Source: ./deprecated_example_test.go:24
|
|
// Use iris.FileServer("./assets", iris.DirOptions{ShowList: false, Gzip: true}) instead.
|
|
}
|
|
|
|
func ExampleParty_StaticEmbedded() {
|
|
api := NewAPIBuilder()
|
|
api.StaticEmbedded("/static", "./assets", nil, nil)
|
|
|
|
err := api.GetReport()
|
|
if err == nil {
|
|
panic("expected report for deprecation")
|
|
}
|
|
|
|
fmt.Print(err)
|
|
// Output: StaticEmbedded is DEPRECATED and it will be removed eventually.
|
|
// It is also miss the AssetInfo bindata function, which is required now.
|
|
// Source: ./deprecated_example_test.go:39
|
|
// Use .HandleDir("/static", "./assets", iris.DirOptions{Asset: Asset, AssetInfo: AssetInfo, AssetNames: AssetNames}) instead.
|
|
}
|
|
|
|
func ExampleParty_StaticEmbeddedGzip() {
|
|
api := NewAPIBuilder()
|
|
api.StaticEmbeddedGzip("/static", "./assets", nil, nil)
|
|
|
|
err := api.GetReport()
|
|
if err == nil {
|
|
panic("expected report for deprecation")
|
|
}
|
|
|
|
fmt.Print(err)
|
|
// Output: StaticEmbeddedGzip is DEPRECATED and it will be removed eventually.
|
|
// It is also miss the AssetInfo bindata function, which is required now.
|
|
// Source: ./deprecated_example_test.go:55
|
|
// Use .HandleDir("/static", "./assets", iris.DirOptions{Gzip: true, Asset: Asset, AssetInfo: AssetInfo, AssetNames: AssetNames}) instead.
|
|
}
|