We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package api
import ( "net/http"
"github.com/gorilla/mux" httpSwagger "github.com/swaggo/http-swagger" _ "github.com/swaggo/http-swagger/example/gorilla/docs"
)
// @title Swagger Coinss API // @Version 1.0 // @description This is Coinss API // @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 API() http.Handler {
router := mux.NewRouter() router.PathPrefix("/swagger/").Handler(httpSwagger.Handler( httpSwagger.URL("http://localhost:5000/swagger/doc.json"), //The url pointing to API definition httpSwagger.DeepLinking(true), httpSwagger.DocExpansion("none"), httpSwagger.DomID("#swagger-ui"), )) //user router.HandleFunc("/signup", signup).Methods(http.MethodPost, http.MethodOptions) router.HandleFunc("/signin", signin).Methods(http.MethodPost, http.MethodOptions) router.Use(handlePanic) router.Use(func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") next.ServeHTTP(w, r) }) }) router.Use(mux.CORSMethodMiddleware(router)) return router
}
The text was updated successfully, but these errors were encountered:
This is happening because you didn't add any annotation for the route functions.
// Signup godoc // @Summary signup route // @Accept json // @Produce json // @Param id path int true "Account ID" // @Success 200 {object} model.User // @Router /signup [post] router.HandleFunc("/signup", signup).Methods(http.MethodPost, http.MethodOptions)
Sorry, something went wrong.
No branches or pull requests
package api
import (
"net/http"
)
// @title Swagger Coinss API
// @Version 1.0
// @description This is Coinss API
// @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 API() http.Handler {
}
The text was updated successfully, but these errors were encountered: