chainx

package module
v0.0.0-...-99127cc Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: MIT Imports: 4 Imported by: 0

README

chainx

I am the author Zhiqiang(YongXuan Tu)
enjoy your web server~

Installation

$ go get -u github.com/Mr-YongXuan/chainx

Import

import (
	"github.com/Mr-YongXuan/chainx"
	"github.com/Mr-YongXuan/chainx/include"
)

Example

package main

import (
	"github.com/Mr-YongXuan/chainx"
	"github.com/Mr-YongXuan/chainx/include"
)

func hello(req *include.ChRequest, res *include.ChResponse) *include.ChResponse {
	res.Jsonify(include.JSON{
		"message": "Hello,Chainx!",
		"user-Agent": req.GetHeader("User-Agent"),
	})

	return res
}

func main() {
	c := chainx.New("127.0.0.1", 8080, true)
	c.Add("/hello", []int{include.ChHttpGet}, hello)
	c.StartService()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSessions

func NewSessions(defaultExpire int64) *lib.Sessions

Types

type Chainx

type Chainx struct {
	Addr      string
	Port      int
	PortReuse bool
	// contains filtered or unexported fields
}

func New

func New(addr string, port int, portReuse bool, termLogger bool) *Chainx

func (*Chainx) Add

func (c *Chainx) Add(router string, methods []int, handler func(req *include.ChRequest, res *include.ChResponse) *include.ChResponse)

func (*Chainx) StartService

func (c *Chainx) StartService()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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