Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/haochi/koala

Lightweight router/multiplexer for Go
https://github.com/haochi/koala

Last synced: about 9 hours ago
JSON representation

Lightweight router/multiplexer for Go

Awesome Lists containing this project

README

        

# koala [![Build Status](https://travis-ci.org/haochi/koala.svg?branch=master)](https://travis-ci.org/haochi/koala) [![GoDoc](https://godoc.org/github.com/haochi/koala?status.svg)](https://godoc.org/github.com/haochi/koala)

lightweight multiplexer for Go

## install

```bash
$ go get "github.com/haochi/koala"
```

```go
package main

import (
"github.com/haochi/koala"
"net/http"
"fmt"
)

func main() {
app := koala.New()

app.Get("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!")
})

app.Get("/~{id}", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "user %s reporting for duty!", koala.Param(r, "id"))
})

panic(http.ListenAndServe(":8080", app))
}

```