Questions tagged [martini]

Martini is a popular, lightweight web framework for Go.

Martini is a powerful package for quickly writing modular web applications/services in Go.

More information: https://github.com/codegangsta/martini

Contributed add-ons: https://github.com/codegangsta/martini-contrib

69 questions
1
vote
1 answer

Go: Variable from PostgreSQL in template not output value (Echo framework)

Many codes taken from Martini example, but this using Echo framework. I can make it works in Martini but not in Echo. server.go: package main import ( "database/sql" "github.com/labstack/echo" _ "github.com/lib/pq" "html/template" …
apasajja
  • 576
  • 2
  • 6
  • 20
1
vote
1 answer

Golang with Martini: Mock testing example

I have put together a piece of code which does a GET on my route. I would like to test this using mocking. I am a Go and a test noob, so any tips are greatly appreciated. My Generate Routes.go generates the routes for the current…
premunk
  • 303
  • 1
  • 4
  • 18
1
vote
1 answer

Put the http.Handler in martini

How do I integrate just like http.FileServer with martini? ` package main import ( "github.com/go-martini/martini" "net/http" ) func main() { m := martini.Classic() //http.Handle("/", http.FileServer(http.Dir("."))) //It doesn't…
dazhuo
  • 13
  • 3
1
vote
1 answer

Error with JSON encoding in Martini

When I'm trying to get JSON data from my database, I get this: {"time":"13:42:21 11.12.14",":":"Привет"} {"time":"13:42:25 11.12.14",":":"Эй!"} var time string var text string type chatbetweenusers struct { Time string `json:"time"` Text…
Murat Kasimov
  • 57
  • 1
  • 4
1
vote
0 answers

Go: Martini Serving static files at templates on subdirectories

I'm doing a project on Martini, and i have my static files (css,js) on a static folder at root folder, and i have my templates with this structure: --static --templates ----services/format.html ----index.html ----layout.html And the handlers for…
afboteros
  • 371
  • 1
  • 5
  • 14
1
vote
1 answer

Martini binding doesn't appear to be working

I'm playing around with Martini, and for some reason I can't get the contrib binding package to work. My struct isn't having the values bound to. I've reduced the code down to it's simplest form, but it still doesn't work. Can anyone see what I'm…
Sekhat
  • 4,435
  • 6
  • 43
  • 50
1
vote
1 answer

Is it possible to use sessionauth of martini with Datastore on google app engine?

I tried to use the example of sessionauth of martini on google app engine and want to save login list in Datastore, but did not know how to deal with appengine.Context. Does anyone has the experience? Thank you. Update: // Auth example is an example…
1
vote
1 answer

Displaying HTML, CSS and Javascript with Martini

I'm trying to build a chatroom using Martini. I put together some HTML, CSS and JS using Bootstrap, and now I want to display it using Martini. I'm able to display a "Hello world" index.html file without much trouble, but when I replace index.html…
Aniruddh Chaturvedi
  • 623
  • 3
  • 9
  • 19
1
vote
2 answers

Querying the database for basic auth using go-http-auth with martini-go

I am attempting to use go-http-auth with martini-go. In the example given here - https://github.com/abbot/go-http-auth package main import ( auth "github.com/abbot/go-http-auth" "fmt" "net/http" ) func Secret(user, realm…
Calvin Cheng
  • 35,640
  • 39
  • 116
  • 167
0
votes
0 answers

Custom error page for 500 server-side errors

I'd like to have a custom error page for when internal server errors occur. Currently, I have my errors wrapped with panic, but this only displays "Internal server error" rather than a nice HTML page with further instructions for the user. Is there…
Benjamin
  • 546
  • 4
  • 12
0
votes
1 answer

Using Martini middleware, log error if response code is greater than 399

If my server handles a request and writes the response code as being greater than 399, I want to log an error trace: bm.Use(func(res http.ResponseWriter, req *http.Request, c martini.Context, log *logging.Logger, statter statsd.Statter) { …
user12861522
0
votes
1 answer

What is the called order of the handlers in martini?

About golang martini We can add middlewares using m.Use(). Of course, "Middleware Handlers are invoked in the order that they are added". In addition, a handler can also be added by router like r.Get("/", handler). Sometimes, we also need a…
Jianglong Chen
  • 515
  • 1
  • 3
  • 13
0
votes
1 answer

golang martini session.Set not setting any value

There isn't much context with this because it really is a situation where something should work, but it just doesn't. I am using the martini framework. In one handler I'm using this: session.Set("deployed", "true") r.Redirect("/myOtherURL",…
Conor
  • 721
  • 1
  • 6
  • 18
0
votes
1 answer

Postgresql Golang Martini Inserting key

I am working on building a social network type server as an exercise using martini, golang, and postgresql to help develop my skills in all three. The few key things that are eluding me are how to insert the primary key from the user table into the…
Sam
  • 203
  • 1
  • 4
  • 13
0
votes
1 answer

Deploy golang martini HTTPS on Heroku server

I am trying to deploy an HTTPS web side on Heroku using Golang-martini. Here is the list I already done: I already enable SSL endpoint in Heroku. (it is paid plugin services) I already purchase my CA certificate key and it could be deploy Heroku.…
Evan Lin
  • 1,272
  • 1
  • 12
  • 25