-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
32 lines (24 loc) · 874 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
25
26
27
28
29
30
31
32
package main
import (
"fmt"
"net/http"
"github.com/AndresJejen/GoPersonalServer/controller"
"github.com/AndresJejen/GoPersonalServer/repository"
"github.com/AndresJejen/GoPersonalServer/router"
"github.com/AndresJejen/GoPersonalServer/service"
)
var (
postRepository repository.PostRepository = repository.NewFirestoreRepository()
postService service.PostService = service.NewPostService(postRepository)
postController controller.PostController = controller.NewPostController(postService)
httpRouter router.Router = router.NewMuxRouter()
)
func main() {
const port string = ":8000"
httpRouter.GET("/", func(resp http.ResponseWriter, req *http.Request) {
fmt.Fprintln(resp, "Your system is Online")
})
httpRouter.GET("/post", postController.GetPost)
httpRouter.POST("/post", postController.AddPost)
httpRouter.SERVE(port)
}