iris-contrib / swagger

Iris middleware to automatically generate RESTful API documentation with Swagger 2.0
MIT License
115 stars 32 forks source link

Can anyone please tell me what am I doing wrong here ? #14

Closed dani-fmena closed 3 years ago

dani-fmena commented 3 years ago

image image

The rest of the main.go file

package main

import (
    "github.com/kataras/iris/v12"
    "github.com/kataras/iris/v12/middleware/recover"

    "github.com/iris-contrib/swagger/v12"              // swagger middleware for Iris
    "github.com/iris-contrib/swagger/v12/swaggerFiles" // swagger embed files

    "go.api.backend/api/endpoints"
    _ "go.api.backend/docs"
)

// @title Swagger Example API
// @version 1.0
// @description This is a sample server Petstore server.
// @termsOfService http://swagger.io/terms/

// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io

// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html

// @host localhost:8080
// #@BasePath /v2
func main() {
    app := iris.New()

    // Built-in
    app.UseRouter(recover.New()) //Recovery middleware recovers from any panics and writes a 500 if there was one.

    endpoints.BookRegister(app)

    //region ======== SWAGGER REGISTRATIONS =================================================
dani-fmena commented 3 years ago

The sample here seems outdated. This works for me.