-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (25 loc) · 962 Bytes
/
main.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
package main
import (
"encoding/json"
"log"
"net/http"
"github.com/gorilla/mux"
)
type Schedule struct {
Date string `jason:"date"`
GigAt string `jason:"at"`
AtTownName string `jason:"town"`
GigUrl string `jason:"url"`
}
var schedules []Schedule
func getGigSchedules(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(schedules)
}
func main() {
r := mux.NewRouter()
schedules = append(schedules, Schedule{Date: "2022/06/26", GigAt: "BnA_WALL", AtTownName: "Nihonbashi", GigUrl: "https://bnawall.com/events/music/4th-mural-wall-exhibition-party/"})
schedules = append(schedules, Schedule{Date: "2022/07/17", GigAt: "Batica", AtTownName: "Ebisu", GigUrl: "http://www.batica.jp/schedule/baddest-nice-guys/"})
r.HandleFunc("/api/gigschedules", getGigSchedules).Methods("GET")
log.Fatal(http.ListenAndServe(":8888", r))
}