anoweb

package module
Version: v1.0.11 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

README

anoweb

                                    _
                                   | |
 _____  ____    ___   _ _ _  _____ | |__
(____ ||  _ \  / _ \ | | | || ___ ||  _ \ 
/ ___ || | | || |_| || | | || ____|| |_) )
\_____||_| |_| \___/  \___/ |_____)|____/ 

::anoweb:: 

The lightweight and powerful web framework using the new way for Go. Another go the way.

{{ Version @VER }}

{{ Powered by go-the-way }}

{{ https://github.com/go-the-way/anoweb }}

CircleCI GitHub go.mod Go version codecov Go Report Card GoDoc Release Mentioned in Awesome Go

Overview

Features

  • Pure native, no third dependencies
  • Basic & Variables & Group router
  • REST-ful controllers
  • Binding & validation
  • Middleware supports
  • Session supports
  • Rich Response supports

Install

require github.com/go-the-way/anoweb latest

Quickstart

package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"time"
	
	"github.com/go-the-way/anoweb"
	"github.com/go-the-way/anoweb/context"
)

func main() {
	go func() {
		time.AfterFunc(time.Second, func() {
			response, _ := http.Get("http://localhost:9494")
			resp, _ := ioutil.ReadAll(response.Body)
			fmt.Println(string(resp))
		})
	}()
	anoweb.Default.Get("/", func(ctx *context.Context) {
		ctx.Text("Hello world")
	}).Run()
}
Thanks

Documentation

Overview

Package anoweb doc

::anoweb::

The lightweight and powerful web framework using the new way for Go. Another go the way.

{{ Version @VER }}

{{ Powered by go-the-way }}

{{ https://github.com/go-the-way/anoweb }}

::quickstart::

package main

import (

"github.com/go-the-way/anoweb"
"github.com/go-the-way/anoweb/context"

)

func main() {

anoweb.Default.Get("/", func(ctx *context.Context) {
	ctx.Text("Hello world")
}).Run()

}

Index

Constants

This section is empty.

Variables

View Source
var Default = New()

Default the default App

Functions

This section is empty.

Types

type App

type App struct {
	ConfigFile string
	Config     *config.Config
	// contains filtered or unexported fields
}

App struct

func New

func New() *App

New return new App

func (*App) AddRouter

func (a *App) AddRouter(r ...*router.Router) *App

AddRouter Add Routers

func (*App) AddRouterGroup

func (a *App) AddRouterGroup(g ...*router.Group) *App

AddRouterGroup Add Group Routers

func (*App) Controller

func (a *App) Controller(c ...rest.Controller) *App

Controller Route REST-ful Controller

func (*App) Delete

func (a *App) Delete(pattern string, handler func(ctx *context.Context)) *App

Delete Route Delete Method

func (*App) FSResource

func (a *App) FSResource(fs *embed.FS, pattern, file, contentType string) *App

FSResource Route a resource

func (*App) FaviconFS

func (a *App) FaviconFS(fs *embed.FS) *App

FaviconFS Use Favicon FS

func (*App) FaviconFile

func (a *App) FaviconFile(file string) *App

FaviconFile Use Favicon File

func (*App) FaviconRoute added in v1.0.4

func (a *App) FaviconRoute(route string) *App

FaviconRoute Use Favicon File

func (*App) Get

func (a *App) Get(pattern string, handler func(ctx *context.Context)) *App

Get Route Get Method

func (*App) Head

func (a *App) Head(pattern string, handler func(ctx *context.Context)) *App

Head Route Head Method

func (*App) Middlewares

func (a *App) Middlewares() []middleware.Middleware

Middlewares Filter Middlewares

func (*App) Options

func (a *App) Options(pattern string, handler func(ctx *context.Context)) *App

Options Route Options Method

func (*App) Patch

func (a *App) Patch(pattern string, handler func(ctx *context.Context)) *App

Patch Route Patch Method

func (*App) Post

func (a *App) Post(pattern string, handler func(ctx *context.Context)) *App

Post Route Post Method

func (*App) Put

func (a *App) Put(pattern string, handler func(ctx *context.Context)) *App

Put Route Put Method

func (*App) RecoveryConfig

func (a *App) RecoveryConfig(codeName string, codeVal int, msgName string) *App

RecoveryConfig Sets Recovery config

func (*App) RecoveryHandler

func (a *App) RecoveryHandler(handlers ...func(ctx *context.Context)) *App

RecoveryHandler Sets Recovery handler

func (*App) Request

func (a *App) Request(pattern string, handler func(ctx *context.Context)) *App

Request Route all Methods

func (*App) Resource

func (a *App) Resource(pattern, file, contentType string) *App

Resource Route a resource

func (*App) Route

func (a *App) Route(method, pattern string, handler func(ctx *context.Context)) *App

Route Route DIY Method

func (*App) Run

func (a *App) Run()

Run App

func (*App) Use

func (a *App) Use(middlewares ...middleware.Middleware) *App

Use Middlewares

func (*App) UseFavicon

func (a *App) UseFavicon() *App

UseFavicon Use Favicon Middleware

func (*App) UseLogger

func (a *App) UseLogger() *App

UseLogger Use Logger Middleware

func (*App) UseRecovery

func (a *App) UseRecovery() *App

UseRecovery Use Recovery Middleware

func (*App) UseSession

func (a *App) UseSession(provider session.Provider, config *session.Config, listener *session.Listener) *App

UseSession Use Session Middleware

func (*App) UseStatic

func (a *App) UseStatic(cache bool, root, prefix string) *App

UseStatic Use Static Resources Middleware

Jump to

Keyboard shortcuts

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