version

package module
v0.0.0-...-47806f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2023 License: MIT Imports: 7 Imported by: 0

README

Version

Getting started

To use in project, run the following command in the terminal

$ go get github.com/adoublef-go/version

Usage

An example of how this project can be used:

mux := chi.NewMux()
mux.Use(v.Version("vnd.api+json"))
mux.Mount("/", v.Match(v.Map{"^1": apiHandlerV1, "^2": apiHandlerV2 }))

Running Locally

You can clone the example package has a small project that can be ran locally. It takes a PORT environment variable (defaults to 8080)

# this is optional as default is set to "8080"
$ cd example
$ go run .

While running, the following API called are accessible to the end user.

# 1.x.y or 2.x.y will yield a response. Anything else will yield an error
$ curl --location 'http://localhost:8080/' \
--header 'Accept: application/vnd.api+json;version=1'

License

adoublef-go/version is free and open-source software licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(cm Map) http.Handler

Types

type Map

type Map map[string]http.Handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL