From 7683f54f14540822ea3952598216839f9aacc610 Mon Sep 17 00:00:00 2001 From: Grant Ammons Date: Sat, 23 Jul 2016 14:48:36 -0400 Subject: add todos --- .todos.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.todos.json b/.todos.json index 9c584cb..ab83a99 100644 --- a/.todos.json +++ b/.todos.json @@ -1 +1 @@ -[{"id":1,"subject":"support for priorities +feature","projects":["feature"],"contexts":[],"due":"2016-07-08","completed":false,"archived":false},{"id":2,"subject":"fix bug with 'tod' not being recognized +bug","projects":["bug"],"contexts":[],"due":"2016-07-08","completed":false,"archived":false},{"id":3,"subject":"separate into packages/directories +refactor","projects":["refactor"],"contexts":[],"due":"2016-07-08","completed":false,"archived":false}] \ No newline at end of file +[{"id":1,"subject":"support for priorities +feature","projects":["feature"],"contexts":[],"due":"2016-07-08","completed":false,"archived":false},{"id":2,"subject":"fix bug with 'tod' not being recognized +bug","projects":["bug"],"contexts":[],"due":"2016-07-08","completed":false,"archived":false},{"id":3,"subject":"separate into packages/directories +refactor","projects":["refactor"],"contexts":[],"due":"2016-07-08","completed":false,"archived":false},{"id":4,"subject":"+documentation re-record how it works using this https://asciinema.org/","projects":["documentation"],"contexts":[],"due":"","completed":false,"archived":false},{"id":5,"subject":"+slideplayer nice quote support","projects":["slideplayer"],"contexts":[],"due":"","completed":false,"archived":false},{"id":6,"subject":"+slideplayer image filters using css3","projects":["slideplayer"],"contexts":[],"due":"","completed":false,"archived":false},{"id":7,"subject":"+slideplayer syntax highlighting and code blocks","projects":["slideplayer"],"contexts":[],"due":"","completed":false,"archived":false},{"id":8,"subject":"+slideplayer presenter notes","projects":["slideplayer"],"contexts":[],"due":"","completed":false,"archived":false}] \ No newline at end of file -- cgit v1.3 From 5c9cb6b5cb09b51b2fa18351ec58d53ad82ac425 Mon Sep 17 00:00:00 2001 From: Grant Ammons Date: Sat, 27 Aug 2016 16:18:16 -0400 Subject: Allow 404s to redirect to index file --- todolist/webapp.go | 73 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/todolist/webapp.go b/todolist/webapp.go index 39d1a9b..5c93e90 100644 --- a/todolist/webapp.go +++ b/todolist/webapp.go @@ -10,7 +10,8 @@ import ( ) const ( - VERSION = "0.2.0" + VERSION = "0.3.0" + S3URL = "https://s3.amazonaws.com/todolist-local/" + VERSION ) type Webapp struct { @@ -27,44 +28,62 @@ func (w *Webapp) Run() { func setupRoutes() *httprouter.Router { router := httprouter.New() - router.GET("/", Scaffold) + router.GET("/", IndexScaffold) router.OPTIONS("/todos", TodoOptions) router.GET("/todos", GetTodos) router.POST("/todos", SaveTodos) + router.NotFound = http.HandlerFunc(RedirectScaffold) return router } -func Scaffold(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { +func IndexScaffold(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { template := ` - - - - - - - - - - Todolist - - - -
- - - - + + + + + + + Todolist + + + +
+ + + + + ` + fmt.Fprintf(w, template) +} + +func RedirectScaffold(w http.ResponseWriter, r *http.Request) { + template := ` + + + + + + + Todolist + + + +
+ + + + ` fmt.Fprintf(w, template) } func urlFor(file string) string { - return "https://s3.amazonaws.com/todolist-local/" + VERSION + "/" + file + return S3URL + "/" + file +} + +func RedirectToIndex(w http.ResponseWriter, r *http.Request) { + http.Redirect(w, r, S3URL+r.URL.Path, 301) } func GetTodos(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { -- cgit v1.3 From e1f901cc29eec9dc55a0629b3b6ed2536deeda3b Mon Sep 17 00:00:00 2001 From: Grant Ammons Date: Sat, 27 Aug 2016 16:18:29 -0400 Subject: Bump version to 0.3.0 --- Rakefile | 3 +-- todo.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index a94149f..afc4ccd 100644 --- a/Rakefile +++ b/Rakefile @@ -10,8 +10,7 @@ Envs = [ {goos: "windows", arch: "amd64"} ] -Version = "0.2.0" - +Version = "0.3.0" task :build do `rm -rf dist/#{Version}` diff --git a/todo.go b/todo.go index 0240886..5d6bc75 100644 --- a/todo.go +++ b/todo.go @@ -10,7 +10,7 @@ import ( ) const ( - VERSION = "0.2.0" + VERSION = "0.3.0" ) func main() { -- cgit v1.3