Total Pageviews

Sunday, 10 November 2019

martini 也是一款不错的Web框架。

web framework for Go

Martini wercker statusGoDoc

NOTE: The martini framework is no longer maintained.

Martini is a powerful package for quickly writing modular web applications/services in Golang.
Language Translations:

Getting Started

After installing Go and setting up your GOPATH, create your first .go file. We'll call it server.go

package main

import "github.com/go-martini/martini"

func main() {
  m := martini.Classic()
  m.Get("/", func() string {
    return "Hello world!"
  })
  m.Run()
}


Then install the Martini package (go 1.1 or greater is required):
go get github.com/go-martini/martini

Then run your server:
go run server.go
You will now have a Martini webserver running on localhost:3000.

Getting Help

Join the Mailing list
Watch the Demo Video
Ask questions on Stackoverflow using the martini tag
GoDoc documentation

Features

  • Extremely simple to use.
  • Non-intrusive design.
  • Plays nice with other Golang packages.
  • Awesome path matching and routing.
  • Modular design - Easy to add functionality, easy to rip stuff out.
  • Lots of good handlers/middlewares to use.
  • Great 'out of the box' feature set.
  • Fully compatible with the http.HandlerFunc interface.
  • Default document serving (e.g., for serving AngularJS apps in HTML5 mode).

More Middleware

For more middleware and functionality, check out the repositories in the martini-contrib organization.

Table of Contents

from https://github.com/go-martini/martini

相关帖子:https://briteming.blogspot.com/2017/10/goweb-beego.html