forked from ebhomengo/niki
Merge pull request 'Add staffapp' (#244) from feature/staffapp into develop
Reviewed-on: ebhomengo/niki#244 Reviewed-by: hossein <h.nazari1990@gmail.com>
This commit is contained in:
commit
71f0e342e4
|
|
@ -0,0 +1,8 @@
|
|||
package staffapp
|
||||
|
||||
import "net/http"
|
||||
|
||||
type Application struct {
|
||||
Config Config
|
||||
HTTPServer *http.Server
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println(" Staffapp Server Starting...")
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Staffapp OK!")
|
||||
})
|
||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package staffapp
|
||||
|
||||
type Config struct {
|
||||
// HTTP server config
|
||||
|
||||
// Database config
|
||||
|
||||
// Logger config
|
||||
|
||||
// Service config
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
type Handler struct{}
|
||||
|
||||
func NewHandler() *Handler {
|
||||
return &Handler{}
|
||||
}
|
||||
|
||||
func (h Handler) HealthCheck(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, map[string]string{"status": "ok"})
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package http
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package http
|
||||
|
||||
import httpserver "git.gocasts.ir/ebhomengo/niki/delivery/http_server"
|
||||
|
||||
type Server struct {
|
||||
HTTPServer *httpserver.Server
|
||||
Handler *Handler
|
||||
}
|
||||
|
||||
func NewServer(httpserver *httpserver.Server) *Server {
|
||||
return &Server{
|
||||
HTTPServer: httpserver,
|
||||
Handler: NewHandler(),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) Serve() {
|
||||
|
||||
}
|
||||
|
||||
func (s *Server) Stop() {}
|
||||
|
||||
func (s *Server) RegisterRoutes() {}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package database
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/repository/mysql"
|
||||
|
||||
type DB struct {
|
||||
conn *mysql.DB
|
||||
}
|
||||
|
||||
func New(conn *mysql.DB) *DB {
|
||||
return &DB{
|
||||
conn: conn,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package service
|
||||
|
|
@ -0,0 +1 @@
|
|||
package service
|
||||
|
|
@ -0,0 +1 @@
|
|||
package service
|
||||
|
|
@ -0,0 +1 @@
|
|||
package service
|
||||
Loading…
Reference in New Issue