zepto

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 22 Imported by: 3

README

Go-Zepto

Zepto is a lightweight web framework written in go.

image

Documentation

Official Documentation


Quickstart

Install the Go-Zepto CLI:

$ go get -u github.com/go-zepto/zepto-cli/cmd/zepto

Create a Project

$ zepto new github.com/username/project

Start development server

$ cd project
$ zepto dev

Great! You brand new project should be running at http://localhost:8000

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggingResponseWriter

func NewLoggingResponseWriter(w http.ResponseWriter) *loggingResponseWriter

Types

type HTTPZeptoHandler

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

func (*HTTPZeptoHandler) ServeHTTP

func (h *HTTPZeptoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HealthHandler

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

type HealthStatus

type HealthStatus struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Age     string `json:"age"`
}

type Option

type Option func(*Options)

func HTTPServer added in v1.0.2

func HTTPServer(s *http.Server) Option

HTTPServer - Use a custom HTTP Server

func Logger

func Logger(l logger.Logger) Option

Logger is the mains logger used in all zepto app

func Name

func Name(n string) Option

Zepto App Name

func SessionName added in v1.0.2

func SessionName(name string) Option

SessionName - Set the session name

func SessionStore added in v1.0.2

func SessionStore(store sessions.Store) Option

SessionStore - Set the session name

func TemplateEngine added in v1.0.2

func TemplateEngine(tmplEngine renderer.Engine) Option

TemplateEngine - Change the template engine implementation

func Version

func Version(v string) Option

Name of Zepto App

func WebpackEnabled added in v1.0.2

func WebpackEnabled(enabled bool) Option

type Options

type Options struct {
	Name           string
	Version        string
	Env            string
	Logger         logger.Logger
	WebpackEnabled bool
	TmplEngine     renderer.Engine
	SessionName    string
	SessionSecret  string
	SessionStore   sessions.Store
	// Custom HTTP server
	HTTPServer *http.Server
}

type Plugin added in v1.0.2

type Plugin interface {
	Name() string
	Instance() interface{}
	PrependMiddlewares() []web.MiddlewareFunc
	AppendMiddlewares() []web.MiddlewareFunc
	OnCreated(z *Zepto)
	OnZeptoInit(z *Zepto)
	OnZeptoStart(z *Zepto)
	OnZeptoStop(z *Zepto)
}

type Zepto

type Zepto struct {
	*web.App
	// contains filtered or unexported fields
}

func NewZepto

func NewZepto(configs ...config.Config) *Zepto

func (*Zepto) AddPlugin added in v1.0.2

func (z *Zepto) AddPlugin(plugin Plugin)

func (*Zepto) DB added in v1.0.2

func (z *Zepto) DB() *gorm.DB

func (*Zepto) InitApp added in v1.0.2

func (z *Zepto) InitApp()

func (*Zepto) Logger

func (z *Zepto) Logger() logger.Logger

func (*Zepto) Plugins added in v1.0.2

func (z *Zepto) Plugins() map[string]Plugin

func (*Zepto) SetupGRPC

func (z *Zepto) SetupGRPC(addr string, fn func(s *grpc.Server))

func (*Zepto) Start

func (z *Zepto) Start()

Jump to

Keyboard shortcuts

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