StarterGin

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 2 Imported by: 3

README

starter-gin

English

[仅发布] 该项目仅为最终发布,不要向该项目直接提交代码,开发请关注 go-spring 项目。

Install

Prerequisites
  • Go >= 1.12
Using go get
go get github.com/go-spring/starter-gin@v1.1.0-rc2 

Quick Start

import _ "github.com/go-spring/starter-gin"

main.go

package main

import (
	"fmt"

	"github.com/go-spring/spring-core/gs"
	"github.com/go-spring/spring-core/web"
	_ "github.com/go-spring/starter-gin"
)

func init() {
	gs.Object(new(Controller)).Init(func(c *Controller) {
		gs.GetMapping("/", c.Hello)
	})
}

type Controller struct {
	GOPATH string `value:"${GOPATH}"`
}

func (c *Controller) Hello(ctx web.Context) {
	ctx.String("%s - hello world!", c.GOPATH)
}

func main() {
	fmt.Println(gs.Run())
}

config/application.properties

web.server.port=8000
➜ curl http://localhost:8000/
/Users/didi/work - hello world!

Customization

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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