-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
30 lines (23 loc) · 738 Bytes
/
main.go
File metadata and controls
30 lines (23 loc) · 738 Bytes
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
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/harsh082ip/Go-Mongo-Notes_App-REST_API-CRUD/controllers"
)
const (
WEBPORT = ":8083"
)
func main() {
r := mux.NewRouter()
r.HandleFunc("/getnotes", controllers.GetNotes).Methods("GET")
r.HandleFunc("/createnote", controllers.CreateNote).Methods("POST")
r.HandleFunc("/getnote/{id}", controllers.GetNoteById).Methods("GET")
r.HandleFunc("/updatenote/{id}", controllers.UpdateNote).Methods("POST")
r.HandleFunc("/deletenote/{id}", controllers.DeleteNote).Methods("GET")
r.HandleFunc("/health", controllers.Health)
fmt.Println("Starting Server at port 8083...")
log.Fatal(http.ListenAndServe(WEBPORT, r))
// controllers.GetNoteById()
}