Add basic swagger documentation

accessible by running with -swagger. Accessible at /swagger/index.html.
Currently doesn't have authentication setup, so no requests will work.
This commit is contained in:
Harvey Tindall
2020-09-24 17:51:13 +01:00
parent 544f5674e8
commit b6537cef65
12 changed files with 3254 additions and 144 deletions
-11
View File
@@ -43,17 +43,6 @@ func CreateToken(userId, jfId string) (string, string, error) {
return token, refresh, nil
}
func respond(code int, message string, gc *gin.Context) {
resp := map[string]string{}
if code == 200 || code == 204 {
resp["response"] = message
} else {
resp["error"] = message
}
gc.JSON(code, resp)
gc.Abort()
}
// Check header for token
func (app *appContext) authenticate(gc *gin.Context) {
header := strings.SplitN(gc.Request.Header.Get("Authorization"), " ", 2)