Skip to content
/ baseurl Public

helper for getting baseurl on http request

License

Notifications You must be signed in to change notification settings

jeteon/baseurl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

baseurl

Build Status GoDoc

A golang utility for getting base url from *http.Request

Install

$ go get github.com/chnlr/baseurl

Example Code

package main

import (
    "net/http"
    "io"

    "github.com/chnlr/baseurl"
)

func handler(w http.ResponseWriter, r *http.Request) {
    // If this handler is listening on `http://localhost:8080/foo/bar`,
    // `baseurl.BaseUrl` is returned `http://localhost:8080`
    io.WriteString(baseurl.BaseUrl(r))
}

Documentation

Please See http://godoc.org/github.com/chnlr/baseurl about more information of this library.

Author

Naoki OKAMURA a.k.a nyarla [email protected]

License

MIT

About

helper for getting baseurl on http request

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages