aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Ammons <gammons@gmail.com>2016-06-20 11:38:09 -0400
committerGrant Ammons <gammons@gmail.com>2016-06-20 11:38:09 -0400
commita551bd14ba7daa48c0c7409001710ed9f57c8046 (patch)
tree095b3d2d310255b0913c33314af6d4a4c8ce3079
parent642a71b941aa382b1e7a42e7e378452007373cda (diff)
Add webapp
-rw-r--r--todo.go2
-rw-r--r--todolist/webapp.go37
2 files changed, 36 insertions, 3 deletions
diff --git a/todo.go b/todo.go
index 3beccc8..0240886 100644
--- a/todo.go
+++ b/todo.go
@@ -10,7 +10,7 @@ import (
)
const (
- VERSION = "0.1.0"
+ VERSION = "0.2.0"
)
func main() {
diff --git a/todolist/webapp.go b/todolist/webapp.go
index 29918bf..302be58 100644
--- a/todolist/webapp.go
+++ b/todolist/webapp.go
@@ -9,6 +9,10 @@ import (
"github.com/julienschmidt/httprouter"
)
+const (
+ VERSION = "0.2.0"
+)
+
type Webapp struct {
Router *httprouter.Router
}
@@ -32,13 +36,42 @@ func setupRoutes() *httprouter.Router {
func Scaffold(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
template := `
- <html>
- <h1>you are here buddy</h1>
+ <!DOCTYPE html>
+ <html lang="en">
+ <head>
+ <style>
+ body {
+ font-family: 'Roboto', sans-serif;
+ margin: 0px;
+ }
+ .red {
+ color: #D50000 !important;
+ }
+ .blue {
+ color: #2196F3 !important;
+ }
+ </style>
+ <meta charset="utf-8">
+ <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500" rel="stylesheet">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <meta name="mobile-web-app-capable" content="yes">
+ <title>Todolist</title>
+ <style>body{font-family:Roboto,sans-serif;margin:0}</style>
+ </head>
+ <body>
+ <div id="app"></div>
+ <script type="text/javascript" src="` + urlFor("common.js") + `"></script>
+ <script type="text/javascript" src="` + urlFor("main.js") + `"></script>
+ </body>
</html>
`
fmt.Fprintf(w, template)
}
+func urlFor(file string) string {
+ return "http://d26ykxqbemi1kc.cloudfront.net/" + VERSION + "/" + file
+}
+
func GetTodos(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
w.Header().Set("Access-Control-Allow-Origin", "*")
app := NewApp()