You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
474 B
28 lines
474 B
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
const Name string = "Lithium"
|
|
const Version string = "0.1.0"
|
|
|
|
type Metadata struct {
|
|
Name string
|
|
Version string
|
|
}
|
|
|
|
func IndexHandler(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(Metadata{Name, Version})
|
|
}
|
|
|
|
func main() {
|
|
r := mux.NewRouter()
|
|
r.HandleFunc("/", IndexHandler)
|
|
|
|
http.ListenAndServe(":8000", r)
|
|
}
|