aboutsummaryrefslogtreecommitdiff
path: root/pkg/handler/git.go
blob: 5b0912187f278158f0ab3ff7287a1a2f06e0e6df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package handler

import (
	"net/http"

	"git.gabrielgio.me/cerrado/pkg/service"
	"git.gabrielgio.me/cerrado/templates"
)

type GitHandler struct {
	gitService *service.GitService
}

func NewGitHandler(gitService *service.GitService) *GitHandler {
	return &GitHandler{gitService}
}

func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) {
	gitList := &templates.GitListPage{g.gitService.ListRepositories()}
	templates.WritePageTemplate(w, gitList)
}