How to use golang gf

(*-*)浩
Release: 2019-12-13 10:46:41
Original
3270 people have browsed it

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
Copy after login

Restrictions

golang版本 >= 1.9.2
Copy after login

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()
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template