summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go5
-rw-r--r--test/main.go37
2 files changed, 37 insertions, 5 deletions
diff --git a/main.go b/main.go
deleted file mode 100644
index e2864ae..0000000
--- a/main.go
+++ /dev/null
@@ -1,5 +0,0 @@
-package growel
-
-func main() {
-
-}
diff --git a/test/main.go b/test/main.go
new file mode 100644
index 0000000..553456d
--- /dev/null
+++ b/test/main.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+ "fmt"
+
+ "github.com/bigcoke233/growel/v2"
+)
+
+func main() {
+ api := growel.New()
+
+ api.GET("/hello", func(c *growel.Context) {
+ c.W.Write([]byte("Hello, World!"))
+ })
+
+ api.GET("/", func(c *growel.Context) {
+ c.W.Write([]byte("This is home."))
+ })
+
+ api.GET("/test", func(c *growel.Context) {
+ c.W.Write([]byte("testing"))
+ })
+
+ api.GET("/test/hello", func(c *growel.Context) {
+ c.W.Write([]byte("testing hello"))
+ })
+
+ api.GET("/test/:uid", func(c *growel.Context) {
+ c.W.Write([]byte(fmt.Sprintf("Testing from %s", c.Params["uid"])))
+ })
+
+ api.GET("/test/:uid/info/:sid", func(c *growel.Context) {
+ c.W.Write([]byte(fmt.Sprintf("Testing from %s info %s", c.Params["uid"], c.Params["sid"])))
+ })
+
+ api.Start(":8080")
+}