Skip to content

Routes

You can add a new route to the server with AddRoute().

main.go
package main
import (
"github.com/razshare/frizzante/web"
"main/lib/handlers"
)
func main() {
servers.
New().
AddRoute(routes.Route{
Pattern: "GET /",
Handler: handlers.Welcome,
}). // Adds route.
Start()
}
lib/handlers/welcome.go
package handlers
import "github.com/razshare/frizzante/connections"
func Welcome(con *connections.Connection) {
con.SendMessage("Hello") // Sends text.
}