| 1234567891011121314151617181920212223242526272829303132 |
- package tile
- import (
- "fmt"
- "net/http"
- "time"
- "appengine"
- "appengine/datastore"
- )
- type Tile struct {
- Created time.Time
- }
- func init() {
- http.HandleFunc("/", handleRoolPath)
- }
- func handleRoolPath(w http.ResponseWriter, r *http.Request) {
- ctx := appengine.NewContext(r)
- key := datastore.NewKey(ctx, "Tile", "root", 0, nil)
- tile := new(Tile)
- if err := datastore.Get(ctx, key, tile); err != nil {
- now := new time.Time()
- tile.Created = now
- }
- fmt.Fprint(w, "Root slash " +tile.Created.String())
- }
|