Questions tagged [goji]

Goji is a minimalistic web framework (in Go) that values composability and simplicity.

Goji is a minimalistic web framework (in ) that values composability and simplicity.

Features

  • Compatible with net/http
  • URL patterns (both Sinatra style /foo/:bar patterns and regular expressions, as well as custom patterns)
  • Reconfigurable middleware stack
  • Context/environment object threaded through middleware and handlers
  • Automatic support for Einhorn, systemd, and more
  • Graceful shutdown, and zero-downtime graceful reload when combined with Einhorn.
  • Ruby on Rails / jQuery style parameter parsing

Links

11 questions
7
votes
1 answer

Listen on TCP4 not TCP6

I am using https://github.com/gin-gonic/gin to write an http service But when I deploy it, it keeps deploying on tcp6(according to netstat) r := gin.Default() //none of these are working , It keeps being listed on…
user914584
  • 571
  • 8
  • 15
4
votes
2 answers

Golang Goji: How to serve static content and api at the same time

I have been playing with Golang for the last two weeks and finally could make a real application work. It uses static HTML files served by NGINX and the API is using Goji Web Framework as backend. I don't use any Golang templating because everything…
coffekid
  • 621
  • 2
  • 10
  • 25
4
votes
3 answers

How can I create separate route groups with different middleware in Goji (Golang)?

I am using Goji (https://github.com/zenazn/goji) and would like to define groups of routes that have their own middleware. For example, all paths under /company should use an LDAP authentication and have a middleware defined to do this. All paths…
william
  • 459
  • 7
  • 18
3
votes
1 answer

Golang: Right way to serve both http & https from Go web app with Goji?

Is this the right way to for a single Go web app (using Goji) to handle both http and https traffic? package main import ( "fmt" "net/http" "github.com/zenazn/goji/graceful" "github.com/zenazn/goji/web" ) func main() { r :=…
Alasdair
  • 13,348
  • 18
  • 82
  • 138
1
vote
1 answer

Goji - How to get a HTML GET form request to GoLang in a variable?

Please take a look at my two files main.go and index.html. I am starting with the Goji web microframework. Find Snippets at the Goji web framework. In my example I can see the HTML form webpage index.html at @Localhost8000 and I can type in the…
Poldi
  • 13
  • 4
0
votes
1 answer

Goji SubRouter returns 404

Here is some code package main import ( "fmt" "net/http" "github.com/zenazn/goji" "github.com/zenazn/goji/web" "github.com/zenazn/goji/web/middleware" ) type handler struct{} func (h handler) ServeHTTP(w http.ResponseWriter,…
Magiq
  • 116
  • 3
0
votes
1 answer

goji/httpauth - Cannot use with the standard Golang 'net/http' library

The code package main import ( "fmt" "log" "net/http" "github.com/goji/httpauth" ) func rootHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain") …
Fredrick Brennan
  • 7,079
  • 2
  • 30
  • 61
0
votes
0 answers

how goji csrf not working with multipart

I'm learning how to develop a website using go and I've decided to try Goji. Everything is working fine except when I'm trying to use CSRF (goji-csrf) on a file upload I keep getting Forbidden - CSRF token invalid but when I removed…
ginad
  • 1,863
  • 2
  • 27
  • 42
0
votes
1 answer

Defined a Goji route with bound parameter but getting 404

I've got a Google App Engine app using Goji and defined the following routes: func init() { mux := web.New() http.Handle("/api/list", mux) mux.Use(middleware.EnvInit) mux.Use(middleware.Logger) mux.Get( "/api/list", …
Pascal Dennerly
  • 212
  • 4
  • 9
0
votes
1 answer

Mapping all routes and its http methods in Goji

I would like to map each route and it's request type (GET, POST, PUT, ...) to generate something like a sitemap.xml in JSON for my restful API. Goji uses functions to create a new route. I could store the paths and handlers in a map. My approach…
user3147268
  • 1,814
  • 7
  • 26
  • 39
0
votes
1 answer

How to recover Go timer from web-server restart (or code refresh/upgrade)?

Consider a web service, for instance, where user can make an API request to start a task at certain scheduled time. Task definition and scheduled time are persisted in a database. First approach I came up with is to start a Go timer and wait for the…
shardnit
  • 127
  • 1
  • 9