Explorar o código

refactored to add caching

Sergey Zavadski %!s(int64=11) %!d(string=hai) anos
pai
achega
8f11ad4425
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      leda/app.lua

+ 3 - 2
leda/app.lua

@@ -3,9 +3,10 @@ local http = require('leda.http')
 local server = http.Server(8080, '')
 
 server.request = function(server, request, response)
-    if request:url():find('/json') then
+    local url = request:url() 
+    if url:find('/json') then
         response.body =  {message= 'Hello, World!'}
-    elseif request:url():find('/plaintext') then    
+    elseif url:find('/plaintext') then    
         response.body =  'Hello, World!'
     end
 end