Skip to content

dhawal55/version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

version

Package 'version' returns a HTTP request multiplexer with a "/version" pattern that return the application's version.

Usage

Implement the Versioner interface and pass it to the New method. Add the returned handler to your request multiplexer.

package main

import (
    "log"
    "net/http"

    "github.com/dhawal55/version"
)

type Version struct{}

func (v *Version) GetVersion() string {
    return "1.0"
}

func main() {
    mux := http.NewServeMux()
    //Add application handlers
    //mux.Handle("/users", userHandler)

    v := &Version{}
    versionMux := version.New(v)
    //Add versionMux to your application mux
    mux.Handle("/", versionMux)

    log.Fatal(http.ListenAndServe(":8080", mux))
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages