goapi

package
v0.0.0-...-a4d7632 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: CC0-1.0 Imports: 5 Imported by: 0

README

Go API Server for openapi

Ovaj API pruža pristup skupu podataka opisuje razne programske jezike te njihove detalje i funkcionalnosti.

Overview

This server was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

To see how to make this your own, look here:

README

  • API version: 1.0.0
  • Build date: 2021-01-02T03:44:01.899742+01:00[Europe/Zagreb]
Running the server

To run the server, follow these simple steps:

go run main.go

To run the server in a docker container

docker build --network=host -t openapi .

Once the image is built, just run

docker run --rm -it openapi 
Known Issue

Endpoints sharing a common path may result in issues. For example, /v2/pet/findByTags and /v2/pet/:petId will result in an issue with the Gin framework. For more information about this known limitation, please refer to gin-gonic/gin#388 for more information.

A workaround is to manually update the path and handler. Please refer to gin-gonic/gin/issues/205#issuecomment-296155497 for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Index

func Index(c *gin.Context)

Index is the index handler.

func NewRouter

func NewRouter() *gin.Engine

NewRouter returns a new router.

Types

type ApiServer

type ApiServer struct {
	*gin.Engine
	// contains filtered or unexported fields
}

func NewServer

func NewServer(db *gorm.DB, router *gin.Engine) ApiServer

func (*ApiServer) ConfigureDefaults

func (s *ApiServer) ConfigureDefaults()

func (*ApiServer) GetRoutes

func (s *ApiServer) GetRoutes() Routes

func (*ApiServer) SetCreatorService

func (s *ApiServer) SetCreatorService(cs services.CreatorService)

func (*ApiServer) SetLanguageService

func (s *ApiServer) SetLanguageService(ls services.LanguageService)

func (*ApiServer) SetRoutes

func (s *ApiServer) SetRoutes(r Routes)

type Route

type Route struct {
	// Name is the name of this Route.
	Name string
	// Method is the string for the HTTP method. ex) GET, POST etc..
	Method string
	// Pattern is the pattern of the URI.
	Pattern string
	// HandlerFunc is the handler function of this route.
	HandlerFunc gin.HandlerFunc
}

Route is the information for every URI.

type Routes

type Routes []Route

Routes is the list of the generated Route.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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