# README
GoWired
💻 Reactive HTML Server Side Rendered by GoLang over WebSockets 🚀
Use Go and Zero JavaScript to program reactive front-ends!
How?
- Render Server Side HTML
- Connect to same server using Websocket
- Send user events
- Change state of component in server
- Render Component and get diff
- Update instructions are sent to the browser
Getting Started
Any suggestions are absolutely welcome
This project it's strongly inspired by Elixir Phoenix LiveView.
Component Example
package components
import (
"github.com/patrickcurl/gowired"
"time"
)
type Clock struct {
gowired.WiredComponentWrapper
ActualTime string
}
func NewClock() *gowired.WiredComponent {
return gowired.NewWiredComponent("Clock", &Clock{})
}
func (t *Clock) Mounted(_ *gowired.WiredComponent) {
go func() {
for {
t.ActualTime = time.Now().Format(time.RFC3339Nano)
time.Sleep((time.Second * 1) / 60)
t.Commit()
}
}()
}
func (t *Clock) TemplateHandler(_ *gowired.WiredComponent) string {
return `
<div>
<span>Time: {{ .ActualTime }}</span>
</div>
`
}
Server Example
package main
import (
"github.com/patrickcurl/gowired"
"github.com/patrickcurl/gowired/examples/components"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/websocket/v2"
)
func main() {
app := fiber.New()
wiredServer := gowired.NewServer()
app.Get("/", wiredServer.CreateHTMLHandler(components.NewClock, gowired.PageContent{
Lang: "us",
Title: "Hello world",
}))
app.Get("/ws", websocket.New(wiredServer.HandleWSRequest))
_ = app.Listen(":3000")
}
That's it
More Examples
Slider
Simple todo
All at once using components
GoBook
# Packages
No description provided by the author
# Functions
AttrMapFromNode todo.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewWiredComponent ...
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
Code automatically generated.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
.
WiredComponentWrapper is a struct.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author
No description provided by the author
HTTPHandlerCtx HTTP Handler with a page level context.
HTTPMiddleware Middleware to run on HTTP requests.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author