baghl

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

baghl

A simple web stack that uses:

B BulmaCSS.

A AlpineJS.

G GO.

H HTMX.

L Lua.

Setup

Make sure to install the baghl-cli with

$   go install github.com/grqphical07/baghl-cli

Then to create a new project run:

$   baghl-cli create PROJECT_NAME_HERE

This will create a new baghl project in the current folder. To add a route to the web app just create a file called get.lua under routes. Baghl uses filesystem routing so the path of a file is it's url. You can create multiple HTTP methods for different routes, just create a lua file called METHOD.lua with an all lowercase name.

Inside of get.lua put:

local baghl = require("baghl")

function View(request)
    return baghl.StringResponse(request.Header, "Hello World", 200)
end

Then finally run the go app to use your web app

$   go run .

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDeleteRoute

func CreateDeleteRoute(path string, d fs.DirEntry, router *gin.Engine)

func CreateGetRoute

func CreateGetRoute(path string, d fs.DirEntry, router *gin.Engine)

func CreateHeadRoute

func CreateHeadRoute(path string, d fs.DirEntry, router *gin.Engine)

func CreateOptionsRoute

func CreateOptionsRoute(path string, d fs.DirEntry, router *gin.Engine)

func CreatePatchRoute

func CreatePatchRoute(path string, d fs.DirEntry, router *gin.Engine)

func CreatePostRoute

func CreatePostRoute(path string, d fs.DirEntry, router *gin.Engine)

func CreatePutRoute

func CreatePutRoute(path string, d fs.DirEntry, router *gin.Engine)

func CreateRouter

func CreateRouter() *gin.Engine

Create the HTTP router based on the filesystem routes

func FileResponse

func FileResponse(L *lua.LState) int

func FilesystemRouteToURLEndpoint

func FilesystemRouteToURLEndpoint(path string) string

func GenerateFilesystemRoutes

func GenerateFilesystemRoutes(router *gin.Engine)

func HTMLResponse

func HTMLResponse(L *lua.LState) int

func HandleError

func HandleError(err error)

func HandleHTTPError

func HandleHTTPError(code int) string

func JSONResponse

func JSONResponse(L *lua.LState) int

func LoadError

func LoadError(file string, code int) (lua.LValue, error)

func LoadViewFunction

func LoadViewFunction(file string, request http.Request) (lua.LValue, error)

func Loader

func Loader(L *lua.LState) int

Main API

func MakeRequestTable

func MakeRequestTable(L *lua.LState, request http.Request) lua.LTable

func Redirect

func Redirect(L *lua.LState) int

func RenderTemplate

func RenderTemplate(file string, data lua.LTable) string

func TextResponse

func TextResponse(L *lua.LState) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址