-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
36 lines (29 loc) · 1.13 KB
/
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
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"dmarc_backend/internal/engine/gethandler"
"dmarc_backend/internal/engine/posthandler"
"dmarc_backend/internal/engine/userhandler"
"net/http"
_ "github.com/lib/pq"
"github.com/gorilla/mux"
)
func main() {
r := mux.NewRouter()
//GET API to retrieve data from the DB.
r.HandleFunc("/getdatabyreportid/", gethandler.HandleGet).Methods("GET")
sh := http.StripPrefix("/swaggerui/", http.FileServer(http.Dir("../internal/infrastructure/swagger/")))
r.PathPrefix("/swaggerui/").Handler(sh)
//POST API to insert data into DB.
r.HandleFunc("/parseXML", posthandler.HandlePost).Methods("POST")
r.HandleFunc("/login/", userhandler.Login).Methods("POST")
r.HandleFunc("/registeruser/", userhandler.Register).Methods("POST")
r.HandleFunc("/verifyemail/", userhandler.VerifyEmail).Methods("POST")
r.HandleFunc("/resetpassword/", userhandler.ResetPassword).Methods("PUT")
r.HandleFunc("/getdatabyuserid/", gethandler.GetDataByUserId).Methods("GET")
r.HandleFunc("/getdatabydomain/", gethandler.HandleGetDataByDomain).Methods("GET")
server := &http.Server{
Addr: ":8080",
Handler: r,
}
server.ListenAndServe()
}