gofur

package module
v0.0.0-...-8116de8 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 16 Imported by: 0

README

GoFur

Web Framework, close to Laravel and Django.

Components

  • Router: httprouter
  • Session Management: scs
  • Migrations: Goose
  • SQL quries: sqlc (Maybe change to GORM)
  • Temlates: templ
  • CSS: TailwindCSS
  • HTMX
  • Console/CLI: cobra
  • Default DB: Postgres (sqlc and goose is bad with other DBs)
  • Auth: No candidate yet
  • Events: no candidate
  • Mails: no candidate
  • Form/Validations: no candidate
  • Static Assets
  • Logging

For now you will need to install templ and air manually (working on making this work with gofur install)

Install the gofur cli

go install "github.com/anthdm/gofur/gofur@latest"

Create new gofur project

gofur new myapp

Install the project

cd myapp && gofur install

Start the project

gofur run

Run application in watch mode using air

air

Initial code based on slick

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRequestBody

func ParseRequestBody[T any](c *Context) (T, error)

ParseRequestBody parses the request body based on the content type and returns the user given type T. Currently JSON and from-urlencoded are supported.

Types

type Context

type Context struct {
	Response http.ResponseWriter
	Request  *http.Request
	// contains filtered or unexported fields
}

func (*Context) FormValue

func (c *Context) FormValue(name string) string

func (*Context) Get

func (c *Context) Get(key string) any

func (*Context) JSON

func (c *Context) JSON(status int, v any) error

func (*Context) Param

func (c *Context) Param(name string) string

func (*Context) Query

func (c *Context) Query(name string) string

func (*Context) Redirect

func (c *Context) Redirect(url string, code int) error

func (*Context) Render

func (c *Context) Render(component templ.Component) error

func (*Context) Set

func (c *Context) Set(key string, value any)

func (*Context) Text

func (c *Context) Text(status int, t string) error

type ErrorHandler

type ErrorHandler func(error, *Context) error

type Gofur

type Gofur struct {
	ErrorHandler ErrorHandler
	// contains filtered or unexported fields
}

func New

func New() *Gofur

func (*Gofur) Delete

func (gf *Gofur) Delete(path string, h Handler, plugs ...Plug)

func (*Gofur) Get

func (gf *Gofur) Get(path string, h Handler, plugs ...Plug)

func (*Gofur) Head

func (gf *Gofur) Head(path string, h Handler, plugs ...Plug)

func (*Gofur) MethodNotAllowed

func (gf *Gofur) MethodNotAllowed(h Handler)

func (*Gofur) Options

func (gf *Gofur) Options(path string, h Handler, plugs ...Plug)

func (*Gofur) Plug

func (gf *Gofur) Plug(plugs ...Plug)

func (*Gofur) Post

func (gf *Gofur) Post(path string, h Handler, plugs ...Plug)

func (*Gofur) Put

func (gf *Gofur) Put(path string, h Handler, plugs ...Plug)

func (*Gofur) Start

func (gf *Gofur) Start() error

type Handler

type Handler func(c *Context) error

type Plug

type Plug func(Handler) Handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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