Comments (7)
Do you want to this? https://github.com/swaggo/http-swagger
from swag.
@warent done.
from swag.
I already created example.
Do you want to don't use swaggo middleware?
from swag.
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.
@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.
Thanks @pei0804 , @easonlin404
I've got the idea from your help.
from swag.
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)
- support generate multi doc files
- nil pointer exception during execution
- Create multi-arch docker image for amd64/arm64
- --tags filter does not respect Markdown assigned to a tag
- Annotation Extensions for Documenting Multiple Response Formats HOT 1
- If I use generic array type instead of regular array it panics. HOT 2
- `swag init` generates `swagger.yaml` file in reverse order HOT 2
- Question: Will v2 be released? HOT 7
- Generated open api missing schema in path/query parameter HOT 1
- Request: When is the expected release date for v2? HOT 1
- Instalation issue
- Generics support cross package HOT 3
- Issue rendering Swagger UI, Blank page HOT 1
- add pattern or example to string value in a model HOT 1
- Ability to override name of enum variants generated from ordered constants
- Swag generate empty path HOT 1
- swag + kiota need the full path name for component HOT 3
- swagger-ui Parser error on line 13 end of the stream or a document separator is expected
- Custom attributes for tags
- Renaming of models HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swag.