Bladeren bron

test commit

zhangwei 3 jaren geleden
bovenliggende
commit
09d0122804
6 gewijzigde bestanden met toevoegingen van 85 en 0 verwijderingen
  1. 7 0
      chbase/Util.go
  2. 29 0
      chface/ChFaceMain.go
  3. 13 0
      chface/core/App.go
  4. 12 0
      chface/http/HttpEntry.go
  5. 10 0
      chface/http/test/TestMisc.go
  6. 14 0
      chfoot/ChFootMain.go

+ 7 - 0
chbase/Util.go

@@ -0,0 +1,7 @@
+package chbase
+
+import "fmt"
+
+func ChCommonTest() {
+	fmt.Println("ch chbase test works")
+}

+ 29 - 0
chface/ChFaceMain.go

@@ -0,0 +1,29 @@
+package main
+
+import (
+	"chathub/chface/http"
+	"fmt"
+	"github.com/etlibgo/et"
+	"github.com/gin-gonic/gin"
+)
+
+func main() {
+	fmt.Println("chathub began")
+
+	fmt.Println(et.StrPadLeft("et pad left", "0", 20))
+
+	eg := gin.Default()
+
+	http.ChHttpEntry(eg)
+
+	eg.GET("/ping", func(c *gin.Context) { // /ping是路由
+		//输出json结果给调用方
+		c.JSON(200, gin.H{
+			"message": "pong",
+		})
+	})
+
+	eg.Run(":8081") // 可以从本地的127.0.0.1:8081访问,不填的话,默认是8080端口
+
+	fmt.Println("chathub ended")
+}

+ 13 - 0
chface/core/App.go

@@ -0,0 +1,13 @@
+package core
+
+func AppPrepare() {
+
+}
+
+func AppStart() {
+
+}
+
+func AppStop() {
+
+}

+ 12 - 0
chface/http/HttpEntry.go

@@ -0,0 +1,12 @@
+package http
+
+import (
+	"chathub/chface/http/test"
+	"github.com/gin-gonic/gin"
+)
+
+func ChHttpEntry(eg *gin.Engine) {
+
+	eg.GET("/test1", test.ChApiTest1)
+
+}

+ 10 - 0
chface/http/test/TestMisc.go

@@ -0,0 +1,10 @@
+package test
+
+import "github.com/gin-gonic/gin"
+
+func ChApiTest1(c *gin.Context) { // /ping是路由
+	//输出json结果给调用方
+	c.JSON(200, gin.H{
+		"message": "test 1 ok",
+	})
+}

+ 14 - 0
chfoot/ChFootMain.go

@@ -0,0 +1,14 @@
+package main
+
+import (
+	"chathub/chbase"
+	"fmt"
+)
+
+func main() {
+	fmt.Println("ch chfoot began")
+
+	chbase.ChCommonTest()
+
+	fmt.Println("ch chfoot ended")
+}