~evanj/cms

ref: 37b75b6fd4e482657f38cb98668b78df49c66971 cms/internal/c/ping/ping.go -rw-r--r-- 504 bytes
37b75b6fEvan M Jones TEST(cache): Attempting to cache at controller level. 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package ping

import (
	"log"
	"net/http"

	"git.sr.ht/~evanj/cms/internal/c"
	"git.sr.ht/~evanj/cms/internal/m/user"
)

type Ping struct {
	*c.Controller
	log *log.Logger
}

type dber interface {
	UserGet(username, password string) (user.User, error)
	UserGetFromToken(token string) (user.User, error)
}

func New(captain *c.Controller, log *log.Logger, db dber) *Ping {
	return &Ping{
		captain,
		log,
	}
}

func (p *Ping) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	p.String(w, r, "pong")
}