Giter VIP home page Giter VIP logo

Comments (7)

pei0804 avatar pei0804 commented on May 13, 2024 1

Do you want to this? https://github.com/swaggo/http-swagger

from swag.

ubogdan avatar ubogdan commented on May 13, 2024 1

@warent done.

from swag.

pei0804 avatar pei0804 commented on May 13, 2024

I already created example.
Do you want to don't use swaggo middleware?

from swag.

hoangtuan151 avatar hoangtuan151 commented on May 13, 2024

Hi,

I saw that all examples in https://github.com/swaggo/swag/tree/master/example are all using GIN framework.

Suppose that I already run "swag init" and having following folder struct:

root_web_folder/
\__ docs
\__ \__ swagger
\__ \__ \__ swagger.json
\__ \__ \__ swagger.yaml

I want to use pure Go for my Web App

func main() {
	http.HandleFunc("/", HandlerFunc_1)
	http.ListenAndServe(":8080", nil)
}

So, how could I provide an API friendly swagger web page to other developer in my team?

from swag.

easonlin404 avatar easonlin404 commented on May 13, 2024

@hoangtuan151 Sorry for the late reply. We have github.com/swaggo/http-swagger if you don't want to use any router lib/framework, only use http.HandleFunc like:

package main

import (
	"net/http"

	"github.com/swaggo/http-swagger"
	_ "github.com/swaggo/http-swagger/example/basic/docs"
	"log"
)

// @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 [email protected]

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

// @host petstore.swagger.io
// @BasePath /v2
func main() {
	http.HandleFunc("/swagger/", httpSwagger.WrapHandler)

	log.Fatal(http.ListenAndServe(":8080", nil))
}

Run it, and browser to http://localhost:8080/swagger/index.html.

I will update document soon.

from swag.

hoangtuan151 avatar hoangtuan151 commented on May 13, 2024

Thanks @pei0804 , @easonlin404
I've got the idea from your help.

from swag.

warent avatar warent commented on May 13, 2024

It took me forever to find this... Highly recommend adding https://github.com/swaggo/http-swagger to the readme please!

from swag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.