This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"html/template" | |
"log" | |
"net/http" | |
"os" | |
) | |
type AllData struct { | |
Nations []AttributeNationData | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result := make([]AttributeNationData, 0) | |
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { | |
log.Println("NewDecoder", err) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataURLNation:= "https://api.kawalcorona.com/" | |
req, err := http.NewRequest("GET", dataURLNation, nil) | |
if err != nil { | |
log.Println("NewRequest: ", err) | |
return | |
} | |
client := &http.Client{} | |
resp, err := client.Do(req) | |
if err != nil { | |
log.Println("Do: ", err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Corona-Indonesia: Corona Data Today</title> | |
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Member struct { | |
Name string `json:"name"` | |
URL string `json:"url"` | |
} | |
members = []Member{} | |
keyword := "r" | |
indexName : "member" | |
typeName := "_doc" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client, err := elastic.NewClient(elastic.SetURL("http://localhost:9200")) | |
if err != nil { | |
log.Panic(err) | |
} |