gingonic

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 3 Imported by: 3

README

Gin Framework Adapter

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

Example

package main

import (
  "github.com/gin-gonic/gin"
  "github.com/manyminds/api2go"
  "github.com/manyminds/api2go-adapter/gingonic"
)

func main() {
  r := gin.Default()
  api := api2go.NewAPIWithRouting(
    "api",
    api2go.NewStaticResolver("/"),
    api2go.DefaultContentMarshalers,
    gingonic.New(r),
  )

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

  r.GET("/ping", func(c *gin.Context) {
    c.String(200, "pong")
  })
  r.Run(":8080") // listen and serve on 0.0.0.0:8080
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(g *gin.Engine) routing.Routeable

New creates a new api2go router to use with the gin framework

Types

This section is empty.

Jump to

Keyboard shortcuts

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