Skip to content

shawntoffel/gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gateway

GoDoc Go Report Card Build Status

Simple API gateway using a reverse proxy

destinations := []string{
    "http://localhost:3000/some/endpoint",
    "http://localhost:3001/some/other/endpoint",
}

g := gateway.NewGateway()
    
for _, destination := range destinations {
    // register an endpoint
    err := g.Handle(destination)

    if err != nil {
        return err
    }
}

// requests to port 8080 will be proxied to the appropriate destination by url path
err = g.Start(8080)

if err != nil {
    return err
}