This commit is contained in:
Andrey Parhomenko 2023-12-14 21:59:41 +03:00
parent 1350191dd4
commit 93eb265886
2 changed files with 14 additions and 14 deletions

View file

@ -1,25 +1,25 @@
package main
import (
"github.com/omnipunk/bond"
"github.com/di4f/bond"
)
var root = bond.Mux().
Def(
"",
bond.ApiFunc(func(c *bond.Context){
c.W.Write([]byte("This is the index page"))
}),
).Def(
Def(
"",
bond.ApiFunc(func(c *bond.Context) {
c.W.Write([]byte("This is the index page"))
}),
).Def(
"hello",
bond.Mux().Def(
"en",
bond.ApiFunc(func(c *bond.Context){
bond.ApiFunc(func(c *bond.Context) {
c.W.Write([]byte("Hello, World!"))
}),
).Def(
"ru",
bond.ApiFunc(func(c *bond.Context){
bond.ApiFunc(func(c *bond.Context) {
c.W.Write([]byte("Привет, Мир!"))
}),
),
@ -28,11 +28,11 @@ Def(
bond.Static("./static"),
).Def(
"test",
bond.ApiFunc(func(c *bond.Context){
bond.ApiFunc(func(c *bond.Context) {
c.SetContentType(bond.PlainText)
c.Printf(
"Path: %q\n" +
"Content-Type: %q\n",
"Path: %q\n"+
"Content-Type: %q\n",
c.Path(), c.ContentType(),
)
c.Printf("Query:\n")
@ -47,7 +47,7 @@ Def(
func main() {
srv := bond.Server{
Addr: ":10800",
Addr: ":10800",
Handler: root,
}
err := srv.ListenAndServe()

2
go.mod
View file

@ -1,3 +1,3 @@
module github.com/omnipunk/bond
module github.com/di4f/bond
go 1.21.3