gorillamux

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Gorilla mux Router Adapter

This adapter must be used in combination with api2go in order to be useful. It allows you to use api2go within your Gorilla mux application.

Example

package main

import (
  "github.com/gorilla/mux"
  "github.com/manyminds/api2go"
  "github.com/manyminds/api2go-adapter/gorillamux"
  "net/http"
)

func main() {
  r := mux.NewRouter()
  api := api2go.NewAPIWithRouting(
    "api",
    api2go.NewStaticResolver("/"),
    api2go.DefaultContentMarshalers,
    gorillamux.New(r),
  )

  // Add your API resources here...
  // see https://github.com/manyminds/api2go for more information

  r.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) {
    w.WriteHeader(http.StatusOK)
    w.Write("pong")
  }).Methods("GET")
  http.Handle("/", r)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(gm *mux.Router) routing.Routeable

New creates a new api2go router to use with the Gorilla mux framework

Types

This section is empty.

Jump to

Keyboard shortcuts

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