Home  >  Article  >  Backend Development  >  How to use golang gf

How to use golang gf

(*-*)浩
(*-*)浩Original
2019-12-13 10:46:413251browse

How to use golang gf

GF (Go Frame) is a modular, loosely coupled, lightweight, high-performance Go language web development framework. (Recommended learning: go)

Supports hot restart, hot update, multiple domain names, multiple ports, multiple services, HTTP/HTTPS, dynamic routing and other features, and provides Web A series of core components for service development.

Such as: Router, Cookie, Session, service registration, configuration management, template engine, data verification, paging management, database ORM, etc., and provides dozens of practical development module sets.

Such as: cache, log, time, command line, binary, file lock, object pool, connection pool, data encoding, process management, process communication, TCP/UDP components, concurrent security container, Goroutine pool, etc. Etc., etc.

Installation

go get -u gitee.com/johng/gf

Restrictions

golang版本 >= 1.9.2

Usage

Hello World

package main
import (
    "gitee.com/johng/gf/g"
    "gitee.com/johng/gf/g/net/ghttp"
)
func main() {
    s := g.Server()
    s.BindHandler("/", func(r *ghttp.Request) {
        r.Response.Write("Hello World")
    })
    s.Run()
}

The above is the detailed content of How to use golang gf. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn