aboutsummaryrefslogtreecommitdiff
path: root/src/server/router.go
blob: 248a1d3b5d108a223b3e88fc27b5469f3740583a (plain)
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
package server

import (
	"net/http"

	"github.com/go-chi/chi/v5"
	"github.com/go-chi/chi/v5/middleware"
	"gitlab.com/alexkavon/newsstand/src/conf"
)

type HandlerFunc func(s *Server) http.HandlerFunc

type Route struct {
	Name         string
	Method       string
	Pattern      string
	AuthRequired bool
	HandlerFunc  HandlerFunc
}

type Routes []Route

func NewRouter(config *conf.Conf) *chi.Mux {
	r := chi.NewRouter()
	r.Use(middleware.Logger)
	return r
}