HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
go-martini
martini
Go2013–2020
go-martini / martini

martini

Classy web framework for Go

19Distinct people
23Mentions
0Explicit recommenders
11.6KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Classy web framework for Go

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 12:03:30 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year23 dated mentions

Observed mentions: 2013-11-14 08:23:32 UTC to 2020-02-04 20:43:29 UTC.

0369122013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 11 mentions; 0 submissions, 11 comments20132014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC11011
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC716
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC303
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Martini NOTE: The martini framework is no longer maintained. Martini is a powerful package for quickly writing modular web applications/services in Golang. Language Translations: 繁體中文 简体中文 Português Brasileiro (pt_BR) Español 한국어 번역 Русский 日本語 French Turkish German Polski 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 Classic Martini Handlers Routing Services Serving Static Files Middleware Handlers Next() Martini Env FAQ Classic Martini To get up and running quickly, martini.Classic() provides some reasonable defaults that work well for most web applications: m := martini.Classic() // ... middleware and routing goes here m.Run() Below is some of the functionality martini.Classic() pulls in automatically: Request/Response Logging - martini.Logger Panic Recovery - martini.Recovery Static File serving - martini.Static Routing - martini.Router Handlers Handlers are the heart and soul of Martini. A handler is basically any kind of callable function: m.Get("/", func() { println("hello world") }) Return Values If a handler returns something, Martini will write the result to the current http.ResponseWriter as a string: m.Get("/", func() string { return "hello world" // HTTP 200 : "hello world" }) You can also optionally return a status code: m.Get("/", func() (int, string) { return 418, "i'm a teapot" // HTTP 418 : "i'm a teapot" }) Service Injection Handlers are invoked via reflection. Martini makes use of Dependency Injection to resolve dependencies in a Handlers argument list. This makes Martini completely compatible with golang's http.HandlerFunc interface. If you add an argument to your Handler, Martini will search its list of services and attempt to resolve the dependency via type assertion: m.Get("/", func(res http.ResponseWriter, req *http.Request) { // res and req are injected by Martini res.WriteHeader(200) // HTTP 200 }) The following services are included with martini.Classic(): *log.Logger - Global logger for Martini. martini.Context - http request context. martini.Params - map[string]string of named params found by route matching. martini.Routes - Route helper service. martini.Route - Current active route. http.ResponseWriter - http Response writer interface. *http.Request - http Request. Routing In Martini, a route is an HTTP method paired with a URL-matching pattern. Each route can take one or more handler methods: m.Get("/", func() { // show something }) m.Patch("/", func() { // update something }) m.Post("/", func() { // create something }) m.Put("/", func() { // replace something }) m.Delete("/", func() { // destroy something }) m.Options("/", func() { // http options }) m.NotFound(func() { // handle 404 }) Routes are matched in the order they are defined. The first route that matches the request is invoked. Route patterns may include named parameters, accessible via the martini.Params service: m.Get("/hello/:name", func(params martini.Params) string { return "Hello " + params["name"] }) Routes can be matched with globs: m.Get("/hello/**", func(params martini.Params) string { return "Hello " + params["_1"] }) Regular expressions can be used as well: m.Get("/hello/(?P<name>[a-zA-Z]+)", func(params martini.Params) string { return fmt.Sprintf ("Hello %s", params["name"]) }) Take a look at the Go documentation for more info about regular expressions syntax . Route handlers can be stacked on top of each other, which is useful for things like authentication and authorization: m.Get("/secret", authorize, func() { // this will execute as long as authorize doesn't write a response }) Route groups can be added too using the Group method. m.Group("/books", func(r martini.Router) { r.Get("/:id", GetBooks) r.Post("/new", NewBook) r.Put("/update/:id", UpdateBook) r.Delete("/delete/:id", DeleteBook) }) Just like you can pass middlewares to a handler you can pass middlewares to groups. m.Group("/books", func(r martini.Router) { r.Get("/:id", GetBooks) r.Post("/new", NewBook) r.Put("/update/:id", UpdateBook) r.Delete("/delete/:id", DeleteBook) }, MyMiddleware1, MyMiddleware2) Services Services are objects that are available to be injected into a Handler's argument list. You can map a service on a Global or Request level. Global Mapping A Martini instance implements the inject.Injector interface, so mapping a service is easy: db := &MyDatabase{} m := martini.Classic() m.Map(db) // the service will be available to all handlers as *MyDatabase // ... m.Run() Request-Level Mapping Mapping on the request level can be done in a handler via martini.Context: func MyCustomLoggerHandler(c martini.Context, req *http.Request) { logger := &MyCustomLogger{req} c.Map(logger) // mapped as *MyCustomLogger } Mapping values to Interfaces One of the most powerful parts about services is the ability to map a service to an in
Read the full README on GitHub

What Hacker News says

1 sources

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.