-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
24 lines (17 loc) · 782 Bytes
/
main.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
package main
import (
"github.com/gorilla/mux"
"log"
"net/http"
"uol.com/sort-o-matic-server/service"
)
func main() {
customerService := service.CustomerService{}
router := mux.NewRouter()
router.HandleFunc("/sortomatic/customers", customerService.GetAllCustomersHandler).Methods("GET")
router.HandleFunc("/sortomatic/search/{name}", customerService.SearchCustomersHandler).Methods("GET")
router.HandleFunc("/sortomatic/customers/{level}", customerService.GetCustomersByLevelHandler).Methods("GET")
router.HandleFunc("/sortomatic/highest-customer", customerService.GetCustomersByHighestPointHandler).Methods("GET")
router.HandleFunc("/sortomatic/average-point", customerService.GetAvgPointHandler).Methods("GET")
log.Fatal(http.ListenAndServe(":8000", router))
}