init
This commit is contained in:
40
core/appserver/server.go
Normal file
40
core/appserver/server.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package appserver
|
||||
|
||||
import (
|
||||
"gitlab.com/arkadooti.sarkar/go-boilerplate/core/appcontext"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type route struct {
|
||||
Name string
|
||||
Method string
|
||||
Pattern string
|
||||
Modules []string
|
||||
ResourcesPermissionMap interface{}
|
||||
HandlerFunc http.HandlerFunc
|
||||
}
|
||||
|
||||
type server struct {
|
||||
port string
|
||||
subRoute string
|
||||
routes []route
|
||||
}
|
||||
|
||||
const (
|
||||
requestID = "requestId"
|
||||
userEmail = "email"
|
||||
application = "application"
|
||||
locale = "locale"
|
||||
)
|
||||
|
||||
type AppServer interface {
|
||||
Start(ctx appcontext.AppContext)
|
||||
AddNoAuthRoutes(methodName string, methodType string, mRoute string, handlerFunc http.HandlerFunc)
|
||||
}
|
||||
|
||||
func NewAppServer(port, subRoute string) AppServer {
|
||||
return &server{
|
||||
port: port,
|
||||
subRoute: subRoute,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user