Init: bootstrap go module with basic framework
This commit is contained in:
15
handlers/api/getAliases.go
Normal file
15
handlers/api/getAliases.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
func (*Handlers) GetAliases(
|
||||
w http.ResponseWriter,
|
||||
req bunrouter.Request,
|
||||
) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
28
handlers/api/getImage.go
Normal file
28
handlers/api/getImage.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.konchin.com/service/amane-tanikaze-dcbot/amane/middlewares"
|
||||
"gitea.konchin.com/service/amane-tanikaze-dcbot/amane/utils"
|
||||
"github.com/uptrace/bunrouter"
|
||||
)
|
||||
|
||||
// GetImage
|
||||
//
|
||||
// @Param id query string true "image id"
|
||||
// @Success 200
|
||||
// @Router /api/image [get]
|
||||
func (*Handlers) GetImage(
|
||||
w http.ResponseWriter,
|
||||
req bunrouter.Request,
|
||||
) error {
|
||||
imageId := req.URL.Query().Get("id")
|
||||
if imageId == "" {
|
||||
return middlewares.HTTPError{
|
||||
StatusCode: http.StatusBadRequest,
|
||||
Message: "must provide id",
|
||||
}
|
||||
}
|
||||
return utils.Success(w)
|
||||
}
|
||||
11
handlers/api/handlers.go
Normal file
11
handlers/api/handlers.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package api
|
||||
|
||||
import "github.com/uptrace/bun"
|
||||
|
||||
type Handlers struct {
|
||||
db *bun.DB
|
||||
}
|
||||
|
||||
func NewHandlers(db *bun.DB) *Handlers {
|
||||
return &Handlers{db: db}
|
||||
}
|
||||
1
handlers/api/postAlias.go
Normal file
1
handlers/api/postAlias.go
Normal file
@@ -0,0 +1 @@
|
||||
package api
|
||||
1
handlers/api/putImage.go
Normal file
1
handlers/api/putImage.go
Normal file
@@ -0,0 +1 @@
|
||||
package api
|
||||
1
handlers/auth/postLogin.go
Normal file
1
handlers/auth/postLogin.go
Normal file
@@ -0,0 +1 @@
|
||||
package auth
|
||||
59
handlers/docs/docs.go
Normal file
59
handlers/docs/docs.go
Normal file
@@ -0,0 +1,59 @@
|
||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"termsOfService": "http://swagger.io/terms/",
|
||||
"contact": {},
|
||||
"license": {
|
||||
"name": "0BSD"
|
||||
},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/api/image": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "image id",
|
||||
"name": "id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "2.0-alpha1",
|
||||
Host: "",
|
||||
BasePath: "/",
|
||||
Schemes: []string{},
|
||||
Title: "Amane Tanikaze Discord Bot Backend",
|
||||
Description: "",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
||||
33
handlers/docs/swagger.json
Normal file
33
handlers/docs/swagger.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Amane Tanikaze Discord Bot Backend",
|
||||
"termsOfService": "http://swagger.io/terms/",
|
||||
"contact": {},
|
||||
"license": {
|
||||
"name": "0BSD"
|
||||
},
|
||||
"version": "2.0-alpha1"
|
||||
},
|
||||
"basePath": "/",
|
||||
"paths": {
|
||||
"/api/image": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "image id",
|
||||
"name": "id",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
handlers/docs/swagger.yaml
Normal file
21
handlers/docs/swagger.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
basePath: /
|
||||
info:
|
||||
contact: {}
|
||||
license:
|
||||
name: 0BSD
|
||||
termsOfService: http://swagger.io/terms/
|
||||
title: Amane Tanikaze Discord Bot Backend
|
||||
version: 2.0-alpha1
|
||||
paths:
|
||||
/api/image:
|
||||
get:
|
||||
parameters:
|
||||
- description: image id
|
||||
in: query
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user