mirror of
https://github.com/donl/gPanel.git
synced 2026-05-27 06:18:06 -06:00
25 lines
656 B
Go
25 lines
656 B
Go
// Package server is a child of package api to handle api calls concerning the server
|
|
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/Ennovar/gPanel/pkg/public"
|
|
)
|
|
|
|
// Start function is called from /api/server/start and turn the public server on.
|
|
func Start(res http.ResponseWriter, req *http.Request, publicServer *public.Controller) bool {
|
|
if req.Method != "UPDATE" {
|
|
http.Error(res, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
|
|
return false
|
|
}
|
|
|
|
err := publicServer.Start()
|
|
if err != nil {
|
|
http.Error(res, err.Error(), http.StatusConflict)
|
|
return false
|
|
}
|
|
|
|
res.WriteHeader(http.StatusNoContent)
|
|
return true
|
|
}
|