repositorypackage
0.0.6-alpha
Repository: https://github.com/brunprogramming/goxt.git
Documentation: pkg.go.dev
# README
Goxt a laravel inspired framework written in Golang
Very thanks to gin-gonic and aymerick I use gin for the http and raymond for the template parsing without his modules create this project was not possible
Quick start
install
[!IMPORTANT] finally the project genereator es ready in the next update i remove this warning
$ go get github.com/BrunProgramming/goxt
This is a example for a basic use
main.go
package main
import (
"github.com/BrunProgramming/goxt"
"fmt"
)
func main() {
router := goxt.NewRouter()
router.Static("/style","./style")
router.Get("/",func(c goxt.Ctx) {
c.View("main",goxt.HbsCtx{},"")
})
router.Get("/:name",func(c goxt.Ctx) {
name := c.Param("name")
c.View("hello",goxt.HbsCtx{
"name":name,
},""/*this is parameter is for you want to change the default views dir put "" if you want to use the default dir*/)
})
fmt.Println("Server listening in http://localhost:8080")
router.Run(":8080")
}
views/main.hbs
<!DOCTYPE html>
<html>
<head>
<title>Goxt the best framework buffalo is noob</title>
</head>
<body>
<h1>Plis enter your name below:</h1>
<form id="form">
<input type="text" id="input">
</form>
<script type="module">
//midutrick copyright midudev©
const $ = selector => document.querySelector(selector)
$("#form").addEventListener("submit",e => {
e.preventDefault()
const value = $("#input").value
history.pushState("",{},`${location.href}${value}`)
location.reload()
})
</script>
</body>
</html>
views/hello.hbs
<!DOCTYPE html>
<html>
<head>
<title>Goxt the best framework buffalo is noob</title>
</head>
<body>
<h1>Hello {{name}}</h1>
</body>
</html>