Commits

Crane Jin  committed ca585db

support tail '/' for most url patterns. so now both /blogs and /blogs/ are available requests.

  • Participants
  • Parent commits 752d45a

Comments (0)

Files changed (1)

File src/mysite.go

     go blog.CollectTags()
     flag.Parse()
     //GET
-    web.Get(`/(en/)?blogs/feed$`, getFeed)
-    web.Get(`/(en/)?blogs/page-([1-9][0-9]*)$`, getBlogsByPage)
-    web.Get(`/(en/)?blogs/([a-zA-Z0-9_\-]*)$`, getBlogBySlug)
-    web.Get(`/(en/)?blogs/tags/(.*)$`, getBlogsByTag)
-    web.Get(`/(en/)?blogs$`, getBlogs)
-    web.Get(`/about$`, aboutPage)
-    web.Get(`/login$`, loginForm)
-    web.Get(`/(en/)?admin$`, adminPage)
-    web.Get(`/(en/)?admin/(create|edit)-blog$`, blogForm)
-    web.Get(`/(en/)?admin/refreshtpl$`, refreshTpl)
+    web.Get(`/(en/)?blogs/feed/?$`, getFeed)
+    web.Get(`/(en/)?blogs/page-([1-9][0-9]*)/?$`, getBlogsByPage)
+    web.Get(`/(en/)?blogs/([a-zA-Z0-9_\-]+)/?$`, getBlogBySlug)
+    web.Get(`/(en/)?blogs/tags/([^/]+)/?$`, getBlogsByTag)
+    web.Get(`/(en/)?blogs/?$`, getBlogs)
+    web.Get(`/about/?$`, aboutPage)
+    web.Get(`/login/?$`, loginForm)
+    web.Get(`/(en/)?admin/?$`, adminPage)
+    web.Get(`/(en/)?admin/(create|edit)-blog/?$`, blogForm)
+    web.Get(`/(en/)?admin/refreshtpl/?$`, refreshTpl)
     web.Get(`/(en/)?$`, indexPage)
-    web.Get(`/words/(2[0-9][1-9][0-9])-([0-1][0-9])-([0-3][0-9])$`, getWordsByDate)
-    web.Get(`/words$`, getDatesForWords)
+    web.Get(`/words/(2[0-9][1-9][0-9])-([0-1][0-9])-([0-3][0-9])/?$`, getWordsByDate)
+    web.Get(`/words/?$`, getDatesForWords)
 
     //POST
     web.Post(`/(en/)?blogs$`, addBlog)