Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // swagger.yml
- ---
- swagger: '2.0'
- info:
- version: 3.0.1
- title: The coolest API
- paths:
- /:
- get:
- produces:
- - text/html
- responses:
- 200:
- description: Return index page
- schema:
- type: string
- // go file
- swaggerSpec, err := loads.Analyzed(restapi.SwaggerJSON, "")
- ...
- api := operations.NewYOURAPI(swaggerSpec)
- api.HTMLProducer = runtime.TextProducer()
- ...
- api.GetHandler = operations.GetHandlerFunc(
- func(params operations.GetParams) middleware.Responder {
- return operations.NewGetOK().WithPayload("<!DOCTYPE html><html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>")
- })
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement