check route added
This commit is contained in:
parent
65bd11f636
commit
23edba6dc6
2 changed files with 10 additions and 0 deletions
|
@ -15,6 +15,15 @@ import (
|
|||
"github.com/chihaya/chihaya/models"
|
||||
)
|
||||
|
||||
func (t *Tracker) check(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
_, err := w.Write([]byte("An easter egg goes here."))
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
return http.StatusOK, nil
|
||||
}
|
||||
|
||||
func (t *Tracker) getTorrent(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
conn, err := t.tp.Get()
|
||||
if err != nil {
|
||||
|
|
|
@ -84,6 +84,7 @@ func NewRouter(t *Tracker, cfg *config.Config) *httprouter.Router {
|
|||
r.GET("/torrents/:infohash", makeHandler(t.getTorrent))
|
||||
r.PUT("/torrents/:infohash", makeHandler(t.putTorrent))
|
||||
r.DELETE("/torrents/:infohash", makeHandler(t.delTorrent))
|
||||
r.GET("/check", makeHandler(t.check))
|
||||
|
||||
return r
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue