Created
December 22, 2010 13:51
Revisions
-
ignacio renamed this gist
Dec 22, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ignacio renamed this gist
Dec 22, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ignacio created this gist
Dec 22, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ require "luanode.http" local router = require "route66".new() router:get("/prompt", function(req, res) res:writeHead(200, { ["Content-Type"] = "text/plain"}) res:finish(">:") end) router:get("/hello/(.+)", function(req, res, user) res:writeHead(200, { ["Content-Type"] = "text/plain"}) res:finish("hello " .. user) end) router:post("/send_code", function(req, res) res:writeHead(200, { ["Content-Type"] = "text/plain"}) if req.body == "4 8 15 16 23 42" then res:finish(">:") else res:finish("boom!") end end) local server = luanode.http.createServer(function (self, req, res) console.log("unrouted request will fall through") end) router:bindServer(server) server:listen(8000) console.info("Server listening at http://127.0.0.1:8000/") process:loop()