func GetGateway(w rest.ResponseWriter, req *rest.Request) {
	gateway := gatewayStruct{}
	err := db.View(func(tx *bolt.Tx) (err error) {
		tmp := tx.Bucket([]byte(routesBucket)).Get([]byte(defaultKey))
		if tmp == nil {
			err = fmt.Errorf("ItemNotFound: Could not find gateway")
			return
		}
		err = json.Unmarshal(tmp, &gateway)
		return
	})
	if err != nil {
		log.Printf(err.Error())
		code := http.StatusInternalServerError
		if strings.Contains(err.Error(), "ItemNotFound") {
			code = http.StatusNotFound
		}
		rest.Error(w, err.Error(), code)
		return
	}
	log.Printf("Requested Gateways list : %s", gateway)
	w.WriteJson(gateway)
}
GetGateway returns the list of all gateways
package gateway
import (
	"encoding/json"
	"fmt"
	"net/http"
	"os/exec"
	"strings"
	log "github.com/Sirupsen/logrus"
	"github.com/ant0ine/go-json-rest/rest"
	"github.com/boltdb/bolt"
)
const (
	routesBucket = "routes"
	defaultKey   = "default"
)
var db *bolt.DB
type gatewayStruct struct {
	IP   string `json:"ip"`
	Link string `json:"link"`
}
func PostGateway(w rest.ResponseWriter, req *rest.Request) {
	gateway := gatewayStruct{}
	if err := req.DecodeJsonPayload(&gateway); err != nil {
		log.Printf(err.Error())
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	db.Update(func(tx *bolt.Tx) (err error) {
		b := tx.Bucket([]byte(routesBucket))
		data, err := json.Marshal(gateway)
		if err != nil {
			return
		}
		log.Printf("Updating key %s with value %s", defaultKey, data)
		err = b.Put([]byte(defaultKey), []byte(data))
		return
	})
	if err := addDefaultGw(gateway.IP, gateway.Link); err != nil {
		log.Printf(err.Error())
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.WriteJson(gateway)
}