slick

package module
v0.0.0-...-487df15 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 16 Imported by: 0

README

Slick

Build web applications faster with all batteries included

Work in progress

I really want to try this out even though its not finished yet.

Spoiler: you will encounter rough edges.

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

Install the Slick cli

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

Create new slick project

slick new myapp

Install the project

cd myapp && slick install

Start the project

slick run

Run application in watch mode using air

air

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 Handler

type Handler func(c *Context) error

type Plug

type Plug func(Handler) Handler

type Slick

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

func New

func New() *Slick

func (*Slick) Delete

func (s *Slick) Delete(path string, h Handler, plugs ...Plug)

func (*Slick) Get

func (s *Slick) Get(path string, h Handler, plugs ...Plug)

func (*Slick) Head

func (s *Slick) Head(path string, h Handler, plugs ...Plug)

func (*Slick) MethodNotAllowed

func (s *Slick) MethodNotAllowed(h Handler)

func (*Slick) Options

func (s *Slick) Options(path string, h Handler, plugs ...Plug)

func (*Slick) Plug

func (s *Slick) Plug(plugs ...Plug)

func (*Slick) Post

func (s *Slick) Post(path string, h Handler, plugs ...Plug)

func (*Slick) Put

func (s *Slick) Put(path string, h Handler, plugs ...Plug)

func (*Slick) Start

func (s *Slick) Start() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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