sw api endpoint

This commit is contained in:
2026-03-01 19:48:44 +01:00
parent f60a5786f6
commit 7623abb01d
4 changed files with 51 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package http
import (
"encoding/json"
"net/http"
"teletype_softwares/domain"
)
type APISoftwareController struct {
softwareService domain.SoftwareServiceInterface
}
func NewAPISoftwareController(software_service domain.SoftwareServiceInterface) *APISoftwareController {
return &APISoftwareController{softwareService: software_service}
}
func (c *APISoftwareController) Index(w http.ResponseWriter, r *http.Request) {
softwares, _ := c.softwareService.DetailedList()
json.NewEncoder(w).Encode(softwares)
}