sw api endpoint
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user