|
|
|
/*
|
|
|
|
------------------------------------------------------------------------------------------------------------------------
|
|
|
|
####### api ####### Copyright (c) 2021 mls-361 ##################################################### MIT License #######
|
|
|
|
------------------------------------------------------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"expvar"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"forge.chapril.org/armen/armen/internal/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
//_maxBodySize = 1024 * 4
|
|
|
|
)
|
|
|
|
|
|
|
|
type api struct {
|
|
|
|
model components.Model
|
|
|
|
}
|
|
|
|
|
|
|
|
func newAPI(model components.Model) *api {
|
|
|
|
return &api{
|
|
|
|
model: model,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (api *api) createJob(rw http.ResponseWriter, r *http.Request) {
|
|
|
|
rw.WriteHeader(http.StatusOK)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Build(router components.Router, model components.Model) {
|
|
|
|
api := newAPI(model)
|
|
|
|
|
|
|
|
router.Get("/debug", expvar.Handler())
|
|
|
|
router.Get("/status", http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
|
|
|
|
rw.WriteHeader(http.StatusOK)
|
|
|
|
}))
|
|
|
|
|
|
|
|
router.Post("/job/create", http.HandlerFunc(api.createJob))
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
######################################################################################################## @(°_°)@ #######
|
|
|
|
*/
|