Categorygithub.com/lengzhao/easyweb
modulepackage
0.2.0
Repository: https://github.com/lengzhao/easyweb.git
Documentation: pkg.go.dev

# README

easyweb

like streamlit, can quickly generate a web

how work

  1. Server and client interact through websocket
  2. The elements of the page are dynamically generated by jquery
  3. The user opens the page, and the page connects to the server through websocket
  4. The server executes the code, dynamically creates elements, and sends them to the client
  5. The elements(First-level) have a unique id, through which to create, update, delete
  6. websocket + jquery(3.7.0 local) + bootstrap(5.3.0 cdn)

exampel

package main

import (
    "fmt"
    "net/http"
    "time"

    "github.com/lengzhao/easyweb"
    "github.com/lengzhao/easyweb/e"
)

func main() {
    easyweb.RegisterPage(func(page easyweb.Page) {
        page.Title("MyWeb")
        page.Write("this is my first ui.")
    }, easyweb.DefaultPagePath...)
    http.ListenAndServe(":8080", nil)
}

The browser opens http://localhost:8080

For more examples, please see the example folder

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

RegisterPage registers a page function to handle HTTP requests for the specified path patterns.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author

# Variables

No description provided by the author
go:embed templates/default.html.

# Interfaces

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