Using mgo and writing handlers in Go with net/http

This is a short example of how to write handlers in Go and use the MongoDB mgo driver.

Assume you want to write handlers that are in a package and mount this handler under a certain prefix,
for instance a HelloHandler mounted on /hello/.

So you have a main package and a handler package, called hello.

Directory structure is

~/go/src/example/hello/
~/go/src/example/hello/main.go
~/go/src/example/hello/hello/
~/go/src/example/hello/hello/hello.go

Run it

and navigate to http://localhost:8080/hello/

 

Neuer Blog

Habe eine neue Blogsoftware geschrieben, also proof of concept.

Mein Privater Blog lebt wieder, allerdings leicht versteckt. Wer ihn findet bekommt … nix.
Das ist der erste Schritt zur kompletten persönlichen Seite.
Dateien, Bilder, Blog, Wiki und was mir noch so einfällt.

 

Best Slug Matching Regex

From Stackoverflow

or short

Go version