Categorygithub.com/dereking/grest
modulepackage
1.0.1
Repository: https://github.com/dereking/grest.git
Documentation: pkg.go.dev

# README

grest

a GO lang REST & web framework.

install

go get github.com/dereking/grest

go install github.com/dereking/grest/grest

start a new project

usage:

  grest SUBCMD ARGS

e.g.create a new GREST project in $GOPATH:

   grest new projectName

The project will be created at $GOPATH/src/ProjectName

static files

The directory named "static" is the place which storages the static files. The subdirectories "css", "js", "images", "fonts", "public" storage the corresponding static files.;

controller

there are one Filter Function in controller.

  • OnExecuting Function

websocket

func (c *WsController) Chat(ws *websocket.Conn) {

	defer ws.Close()

	var err error
	var str string

	for { 
		str = "hello, I'm server."

		if err = websocket.Message.Send(ws, str); err != nil {
			break
		} else {
			time.Sleep(time.Second * 2)
		}
	}
}

template Function

  • html 输出html代码. 对字符串进行html关键词\标签转义.
  • fileSize 输出方便阅读的文件大小字符串。
  • datetime 输出日期时间,2017-3-19 00:08:20格式.
  • add 数字加1

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
----------------------------------------------this go file is generated by staticZip.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author

# Structs

No description provided by the author