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
| package blobstrex | |
| import ( | |
| "fmt" | |
| "html/template" | |
| "io" | |
| "net/http" | |
| "github.com/rwcarlsen/goexif/exif" | |
| "strconv" | |
| "appengine" |
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 Numverify struct { | |
| Valid bool `json:"valid"` | |
| Number string `json:"number"` | |
| LocalFormat string `json:"local_format"` | |
| InternationalFormat string `json:"international_format"` | |
| CountryPrefix string `json:"country_prefix"` | |
| CountryCode string `json:"country_code"` | |
| CountryName string `json:"country_name"` | |
| Location string `json:"location"` | |
| Carrier string `json:"carrier"` |
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
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "net/url" | |
| ) |
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 Currencylayer struct { | |
| Success bool `json:"success"` | |
| Terms string `json:"terms"` | |
| Privacy string `json:"privacy"` | |
| Timestamp int `json:"timestamp"` | |
| Source string `json:"source"` | |
| Quotes struct { | |
| Usdeur float64 `json:"USDEUR"` | |
| Usdinr float64 `json:"USDINR"` | |
| } `json:"quotes"` |
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
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| ) | |
| type Currencylayer struct { |
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
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>Go Web Programming</title> | |
| </head> | |
| <body> | |
| {{ template "content.html" }} | |
| </body> | |
| </html> |
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
| {{ define "layout" }} | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>Go Web Programming</title> | |
| </head> | |
| <body> | |
| {{ template "content" }} | |
| </body> | |
| </html> |
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
| {{ define "layout" }} | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>Go Web Programming</title> | |
| </head> | |
| <body> | |
| {{ template "content" }} | |
| </body> | |
| </html> |
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
| func process(w http.ResponseWriter, r *http.Request) { | |
| t, _ := template.ParseFiles("layout.html") | |
| t.ExecuteTemplate(w, "layout", "") | |
| } |
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
| > curl -i http://127.0.0.1:8080/process | |
| HTTP/1.1 200 OK | |
| Date: Sun, 08 Feb 2015 14:09:15 GMT | |
| Content-Length: 187 | |
| Content-Type: text/html; charset=utf-8 | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>Go Web Programming</title> |