simpified ron frameworks and correct some fixes

added example
still learning how to works http package
This commit is contained in:
2024-11-12 10:00:14 +01:00
parent b8a0e3cde4
commit fb9904cf03
4 changed files with 83 additions and 75 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"log/slog"
"net/http"
"ron"
)
func main() {
r := ron.New()
r.GET("/", helloWorld)
r.POST("/another", anotherHelloWorld)
slog.Info("Server is running at http://localhost:8080")
http.ListenAndServe(":8080", r)
}
func helloWorld(c *ron.Context) {
c.W.Write([]byte("hello world"))
}
func anotherHelloWorld(c *ron.Context) {
c.W.Write([]byte("another hello world"))
}