Skip to content
GitHub no longer supports this web browser. Learn more about the browsers we support.
Package macaron is a high productive and modular web framework in Go.
Go
Branch: master
Clone or download
Latest commit 993bb1c Oct 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
fixtures Add AppendDirectories option to render Mar 12, 2016
.gitignore Expose some objects Jul 15, 2016
.travis.yml ci: fix script Aug 4, 2019
LICENSE MISC: update LICENSE identifying info and README Oct 17, 2017
README.md Update README.md Oct 19, 2019
context.go *: enable Go modules Aug 4, 2019
context_test.go *: enable Go modules Aug 4, 2019
go.mod go.mod: tidy Oct 19, 2019
go.sum go.mod: tidy Oct 19, 2019
logger.go logger: show request method for complete Feb 19, 2017
logger_test.go *: enable Go modules Aug 4, 2019
macaron.go Bump version Aug 5, 2019
macaron_test.go new license and API Oct 13, 2015
macaronlogo.png Logo Oct 13, 2014
recovery.go new license and API Oct 13, 2015
recovery_test.go new license and API Oct 13, 2015
render.go *: enable Go modules Aug 4, 2019
render_test.go integration FastInvoke Handler (#91) Jan 28, 2017
response_writer.go response_writer: fix writing body for HEAD method (#85) Mar 6, 2018
response_writer_test.go response_writer: fix writing body for HEAD method (#85) Mar 6, 2018
return_handler.go new license and API Oct 13, 2015
return_handler_test.go integration FastInvoke Handler (#91) Jan 28, 2017
router.go router: support autoHead for ComboRouter Mar 6, 2018
router_test.go response_writer: fix writing body for HEAD method (#85) Mar 6, 2018
static.go Add ETag header to staticHandler (#114) Jan 22, 2017
static_test.go Add ETag header to staticHandler (#114) Jan 22, 2017
tree.go *: enable Go modules Aug 4, 2019
tree_test.go router: handle URLs with escaped characters (#149) Nov 24, 2017
util_go17.go router: handle URLs with escaped characters (#149) Nov 24, 2017
util_go18.go router: handle URLs with escaped characters (#149) Nov 24, 2017

README.md

Macaron Build Status

Macaron Logo

Package macaron is a high productive and modular web framework in Go.

Getting Started

The minimum requirement of Go is 1.6.

To install Macaron:

go get gopkg.in/macaron.v1

The very basic usage of Macaron:

package main

import "gopkg.in/macaron.v1"

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

Features

  • Powerful routing with suburl.
  • Flexible routes combinations.
  • Unlimited nested group routers.
  • Directly integrate with existing services.
  • Dynamically change template files at runtime.
  • Allow to use in-memory template and static files.
  • Easy to plugin/unplugin features with modular design.
  • Handy dependency injection powered by inject.
  • Better router layer and less reflection make faster speed.

Middlewares

Middlewares allow you easily plugin/unplugin features for your Macaron applications.

There are already many middlewares to simplify your work:

  • render - Go template engine
  • static - Serves static files
  • gzip - Gzip compression to all responses
  • binding - Request data binding and validation
  • i18n - Internationalization and Localization
  • cache - Cache manager
  • session - Session manager
  • csrf - Generates and validates csrf tokens
  • captcha - Captcha service
  • pongo2 - Pongo2 template engine support
  • sockets - WebSockets channels binding
  • bindata - Embed binary data as static and template files
  • toolbox - Health check, pprof, profile and statistic services
  • oauth2 - OAuth 2.0 backend
  • authz - ACL/RBAC/ABAC authorization based on Casbin
  • switcher - Multiple-site support
  • method - HTTP method override
  • permissions2 - Cookies, users and permissions
  • renders - Beego-like render engine(Macaron has built-in template engine, this is another option)
  • piwik - Server-side piwik analytics

Use Cases

  • Gogs: A painless self-hosted Git Service
  • Grafana: The open platform for beautiful analytics and monitoring
  • Peach: A modern web documentation server
  • Go Walker: Go online API documentation
  • Critical Stack Intel: A 100% free intel marketplace from Critical Stack, Inc.

Getting Help

Credits

License

This project is under the Apache License, Version 2.0. See the LICENSE file for the full license text.

You can’t perform that action at this time.