-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.go
47 lines (35 loc) · 744 Bytes
/
api.go
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package v1
import (
"net/http"
"github.com/go-chi/chi"
"github.com/rojasuap/go-backend-api_facturacion/internal/data"
)
// New returns the API V1 Handler with configuration.
func New() http.Handler {
r := chi.NewRouter()
ur := &UserRouter{
Repository: &data.UserRepository{
Data: data.New(),
},
}
r.Mount("/users", ur.Routes())
pr := &MedicineRouter{
Repository: &data.MedicineRepository{
Data: data.New(),
},
}
r.Mount("/medicines", pr.Routes())
px := &PromotionRouter{
Repository: &data.PromotionRepository{
Data: data.New(),
},
}
r.Mount("/promotions", px.Routes())
br := &BillRouter{
Repository: &data.BillRepository{
Data: data.New(),
},
}
r.Mount("/bills", br.Routes())
return r
}