From 9e8502e21a9b139b93de1ad762996d9766ec6b81 Mon Sep 17 00:00:00 2001 From: sipp11 Date: Tue, 20 Mar 2018 18:53:23 +0900 Subject: [PATCH] Start simple UI --- home.html | 8 ----- html/home.html | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++ read_item.go | 6 ++-- 3 files changed, 92 insertions(+), 12 deletions(-) delete mode 100644 home.html create mode 100644 html/home.html diff --git a/home.html b/home.html deleted file mode 100644 index d9dad27..0000000 --- a/home.html +++ /dev/null @@ -1,8 +0,0 @@ - -
- Home -
- -

{{ query }}

- - \ No newline at end of file diff --git a/html/home.html b/html/home.html new file mode 100644 index 0000000..74bd0a1 --- /dev/null +++ b/html/home.html @@ -0,0 +1,90 @@ + + + + + + + + Life Around + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + diff --git a/read_item.go b/read_item.go index fa2555c..e0c375d 100644 --- a/read_item.go +++ b/read_item.go @@ -3,7 +3,6 @@ package main import ( "encoding/json" "fmt" - "html/template" "net/http" "os" @@ -16,7 +15,7 @@ import ( "github.com/labstack/echo/middleware" ) -var tplHome = pongo2.Must(pongo2.FromFile("home.html")) +var tplHome = pongo2.Must(pongo2.FromFile("html/home.html")) var sess *session.Session var err error var svc *dynamodb.DynamoDB @@ -28,9 +27,8 @@ func indexHandler(c echo.Context) error { out, err := tplHome.Execute(pongo2.Context{"query": "dddd"}) if err != nil { return err - // http.Error(w, err.Error(), http.StatusInternalServerError) } - return c.Render(http.StatusOK, "home", template.HTML(out)) + return c.HTML(http.StatusOK, out) } func healthCheckHandler(c echo.Context) error {