kinetic

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 19 Imported by: 0

README

kinetic

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ContentType  string
	Length       string
	CacheControl string
	LastModified string
	Data         []byte
}

type Context

type Context struct {
	Base    *base     // base methods
	Context *rcontext // request context with value
	Cookie  *cookie   // methods with HTTP cookies
	Engine  *engine   // template engine
	Forms   *forms    // get values from html forms
	Headers *headers  // get,set,del http headers
	Meta    *meta     // metainfo
	Reader  *reader   // read data from request
	Static  *static   // manipulate with static files
	Query   *query    // query params
	Writer  *writer   // send data to response
	// contains filtered or unexported fields
}

type Data

type Data map[string]any

type File

type File struct {
	// contains filtered or unexported fields
}

type Handler

type Handler func(ctx *Context)

type Info

type Info struct {
	Host             string   `json:"host"`
	Method           string   `json:"method"`
	RemoteAddr       string   `json:"remote_addr"`
	RequestURI       string   `json:"request_URI"`
	ContentLength    int64    `json:"content_length"`
	Proto            string   `json:"proto"`
	Referer          string   `json:"referer"`
	TransferEncoding []string `json:"transfer_encoding"`
	UserAgent        string   `json:"user_agent"`
	Close            bool     `json:"close"`
}

type Key

type Key string

type Kinetic

type Kinetic struct {
	// contains filtered or unexported fields
}

func New

func New() *Kinetic

Kinetic builder.

func (*Kinetic) Connect

func (k *Kinetic) Connect(p string, h Handler, m ...Middleware)

Method registers http-method CONNECT.

func (*Kinetic) Delete

func (k *Kinetic) Delete(p string, h Handler, m ...Middleware)

Method registers http-method DELETE.

func (*Kinetic) Get

func (k *Kinetic) Get(p string, h Handler, m ...Middleware)

Method registers http-method GET.

func (*Kinetic) Head

func (k *Kinetic) Head(p string, h Handler, m ...Middleware)

Method registers http-method HEAD.

func (*Kinetic) NotFound

func (k *Kinetic) NotFound(h Handler, m ...Middleware)

Method registers 404 error handler (not found).

func (*Kinetic) Options

func (k *Kinetic) Options(p string, h Handler, m ...Middleware)

Method registers http-method OPTIONS.

func (*Kinetic) Patch

func (k *Kinetic) Patch(p string, h Handler, m ...Middleware)

Method registers http-method PATCH.

func (*Kinetic) Post

func (k *Kinetic) Post(p string, h Handler, m ...Middleware)

Method registers http-method POST.

func (*Kinetic) Put

func (k *Kinetic) Put(p string, h Handler, m ...Middleware)

Method registers http-method PUT.

func (*Kinetic) ServeHTTP

func (k *Kinetic) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implementation.

func (*Kinetic) Static

func (k *Kinetic) Static(prefix string, dir string) error

Method caches static files.

func (*Kinetic) Templates

func (k *Kinetic) Templates(dir string) error

Method compiles templates.

func (*Kinetic) Trace

func (k *Kinetic) Trace(p string, h Handler, m ...Middleware)

Method registers http-method TRACE.

func (*Kinetic) Use

func (k *Kinetic) Use(middlewares ...Middleware)

Method registers handlers as middleware.

type Middleware

type Middleware func(next Handler) Handler

type Response

type Response struct {
	Endpoint   string `json:"endpoint"`
	Status     bool   `json:"status"`
	StatusCode int    `json:"code"`
	Payload    string `json:"payload"`
	TimeStamp  int64  `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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