-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebservermux.go
41 lines (33 loc) · 936 Bytes
/
webservermux.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// package main
// import (
// "fmt"
// "net/http"
// "gorilla/mux"
// )
// //Article describes a article entity
// type Article struct {
// Name string `json:"name"`
// Desc string `json:"desc"`
// }
// //Version defines the application current version
// type Version struct {
// Version int `json:"version"`
// }
// func getVersion(response http.ResponseWriter, request *http.Request) {
// fmt.Fprintf(response, "%v\n", Version{Version: 1})
// }
// func getArticles(response http.ResponseWriter, request *http.Request) {
// articles := []Article{
// Article{Name: "Sample", Desc: "Sample Description"},
// }
// fmt.Fprintf(response, "%v\n", articles)
// }
// func registerHandlerForApplication() {
// myRouter := mux.New
// http.HandleFunc("/version", getVersion)
// http.HandleFunc("/articles", getArticles)
// http.ListenAndServe(":8080", nil)
// }
// func main() {
// registerHandlerForApplication()
// }