iris/core/router/deprecated_example_test.go
Gerasimos (Makis) Maropoulos d0104defa8 create the new FileServer and HandleDir, deprecate the rest APIBuilder/Party static methods and more
relative: https://github.com/kataras/iris/issues/1283 and removing pongo2 from vendor: https://github.com/kataras/iris/issues/1284

Former-commit-id: 3ec57b349f99faca2b8e36d9f7252db0b6ea080d
2019-06-21 19:43:25 +03:00

68 lines
2.1 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: C:/mygopath/src/github.com/kataras/iris/core/router/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: C:/mygopath/src/github.com/kataras/iris/core/router/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: C:/mygopath/src/github.com/kataras/iris/core/router/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: C:/mygopath/src/github.com/kataras/iris/core/router/deprecated_example_test.go:55
// Use .HandleDir("/static", "./assets", iris.DirOptions{Gzip: true, Asset: Asset, AssetInfo: AssetInfo, AssetNames: AssetNames}) instead.
}