Files
teletypegames/http/controller.api.software.go
T
2026-03-01 19:48:44 +01:00

22 lines
517 B
Go

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)
}