skipper: github.com/zalando/skipper/dataclients/routestring Index | Examples | Files

package routestring

import "github.com/zalando/skipper/dataclients/routestring"

Package routestring provides a DataClient implementation for setting route configuration in form of simple eskip string.

Usage from the command line:

skipper -inline-routes '* -> inlineContent("Hello, world!") -> <shunt>'

Code:

rs, err := routestring.New(`* -> inlineContent("Hello, world!") -> <shunt>`)
if err != nil {
    log.Println(err)
    return
}

go skipper.Run(skipper.Options{
    Address:           ":9999",
    CustomDataClients: []routing.DataClient{rs},
})

rsp, err := http.Get("http://localhost:9999")
if err != nil {
    log.Println(err)
    return
}

defer rsp.Body.Close()
content, err := ioutil.ReadAll(rsp.Body)
if err != nil {
    log.Println(err)
    return
}

fmt.Println(string(content))

Output:

Hello, world!

Index

Examples

Package Files

string.go

func New Uses

func New(r string) (routing.DataClient, error)

New creates a data client that parses a string of eskip routes and serves it for the routing package.

Package routestring imports 2 packages (graph) and is imported by 3 packages. Updated 2019-03-17. Refresh now. Tools for package owners.