summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorAsbjørn Sloth Tønnesen <asbjorn@asbjorn.biz>2012-07-10 19:53:03 +0000
committerAsbjørn Sloth Tønnesen <asbjorn@asbjorn.biz>2012-07-10 19:53:03 +0000
commitab4dc8e884b96bb02cde3c4b842a6237c173e49e (patch)
tree1b87d8ca4bd79e01693f2921a3dc2def1c49c800 /web
parentcf7ed2625456a5e619f68408f8ebfe78f443a672 (diff)
downloadlabitrack-ab4dc8e884b96bb02cde3c4b842a6237c173e49e.tar.gz
labitrack-ab4dc8e884b96bb02cde3c4b842a6237c173e49e.tar.xz
labitrack-ab4dc8e884b96bb02cde3c4b842a6237c173e49e.zip
Upgrade to new Hathaway API
Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.biz>
Diffstat (limited to 'web')
-rwxr-xr-xweb/labitrackd.lua21
1 files changed, 6 insertions, 15 deletions
diff --git a/web/labitrackd.lua b/web/labitrackd.lua
index 6a14782..1f25371 100755
--- a/web/labitrackd.lua
+++ b/web/labitrackd.lua
@@ -168,11 +168,11 @@ local htmlpage = sendfile('text/html; charset=UTF-8', 'pub/index.html')
GET('/', htmlpage)
GET('/browse', htmlpage)
-MATCH('^/browse/(%d+)$', htmlpage)
+GETM('^/browse/(%d+)$', htmlpage)
GET('/recent', htmlpage)
GET('/about', htmlpage)
-MATCH('^/view/(%d+)$', htmlpage)
-MATCH('^/edit/(%d+)$', htmlpage)
+GETM('^/view/(%d+)$', htmlpage)
+GETM('^/edit/(%d+)$', htmlpage)
GET('/js/corelibs.min.js', sendfile_js('js/dist/corelibs.min.js'))
GET('/js/corelibs.src.js', sendfile_js('js/dist/corelibs.src.js'))
@@ -192,11 +192,7 @@ GET('/css/labitrack.css', sendfile_css('css/dist/labitrack.min.css'))
GET('/favicon.ico', sendfile('image/x-icon', 'pub/favicon.ico'))
-MATCH('^/browse/(%d+).json$', function(req, res, since)
- if req.method ~= 'HEAD' and req.method ~= 'GET' then
- return hathaway.method_not_allowed(req, res)
- end
-
+GETM('^/browse/(%d+).json$', function(req, res, since)
set_json_nocache_headers(res)
res:add('{"count": %d, "objects":', count());
@@ -248,14 +244,9 @@ local function save_or_update(req, res)
end
POST('/o', save_or_update)
+PUTM('^/o/(%d+).json$', save_or_update)
-MATCH('^/o/(%d+).json$', function(req, res, id)
- if req.method == 'PUT' then
- return save_or_update(req, res)
- elseif req.method ~= 'HEAD' and req.method ~= 'GET' then
- return hathaway.method_not_allowed(req, res)
- end
-
+GETM('^/o/(%d+).json$', function(req, res, id)
set_json_nocache_headers(res)
qr = db:run('get', id)