-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
29 lines (23 loc) · 744 Bytes
/
main.go
File metadata and controls
29 lines (23 loc) · 744 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
package main
import (
"firebase/controller"
router "firebase/http"
"fmt"
"net/http"
"os"
)
var (
postController controller.PostController = controller.NewPostController()
httpRouter router.Router = router.NewChiRouter()
)
func main() {
os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", "D:/Code/projects/todo-app-62a46-firebase-adminsdk-hk1m0-1bb41e1192.json")
const port string = ":8000"
httpRouter.GET("/", func(response http.ResponseWriter, request *http.Request) {
fmt.Fprintln(response, "Hello World!")
})
httpRouter.GET("/posts", postController.GetPosts)
httpRouter.POST("/posts", postController.AddPost)
httpRouter.SERVE(port)
// D:\Code\projects\todo-app-62a46-firebase-adminsdk-hk1m0-1bb41e1192.json
}