refactor: updated routes and handlers
This commit is contained in:
parent
947fbba854
commit
4d96010199
3 changed files with 33 additions and 18 deletions
|
|
@ -2,6 +2,7 @@ package service
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
|
@ -34,12 +35,13 @@ func (s *Service) ListPlugins() http.HandlerFunc {
|
|||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
fmt.Printf("%v", plugins)
|
||||
|
||||
w.Write(body)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) GetPlugin() http.HandlerFunc {
|
||||
func (s *Service) GetPluginInfo() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
pluginName = chi.URLParam(r, "name")
|
||||
|
|
@ -55,7 +57,7 @@ func (s *Service) GetPlugin() http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
body, err = json.Marshal(plugin)
|
||||
body, err = json.Marshal(makeshift.PluginToMap(plugin))
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
|
@ -65,6 +67,12 @@ func (s *Service) GetPlugin() http.HandlerFunc {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Service) GetPluginRaw() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) CreatePlugin() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue