u
This commit is contained in:
1 parent
7c8e2906bc
commit
72a1a9184a
25 files changed
+744
-125
No files matched your search
@@ -0,0 +1,10 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"base-framework/internal/app/handle"
|
||||
"base-framework/pkg/router"
|
||||
)
|
||||
|
||||
func InitTest(r *router.Router) {
|
||||
r.GET("/test", handle.Test)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package handle
|
||||
|
||||
import (
|
||||
"base-framework/pkg/router"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Test(c *router.Context) {
|
||||
c.JSON(http.StatusOK, map[string]string{
|
||||
"user_id": c.Param("id"),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"base-framework/internal/app/api"
|
||||
"base-framework/pkg/middleware"
|
||||
"base-framework/pkg/router"
|
||||
)
|
||||
|
||||
func InitAppRouter() *router.Router {
|
||||
r := router.NewRouter()
|
||||
|
||||
r.Use(middleware.Recover())
|
||||
r.Use(middleware.Auth()).ExcludePaths("/login")
|
||||
r.Use(middleware.Logger())
|
||||
|
||||
initApi(r)
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func initApi(r *router.Router) {
|
||||
api.InitTest(r)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package app
|
||||
|
||||
func RunServer() {
|
||||
}
|
||||
Reference in new issue
Block a user