Created
January 11, 2014 18:06
-
-
Save leite/8374450 to your computer and use it in GitHub Desktop.
dead simple sinatra openresty application
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 characters
local sinatra = require('sinatra'); | |
local app = sinatra.app:new() | |
app:get("/", function() | |
return "Hello, World " | |
end) | |
app:get("/:name", function() | |
return "Hello, " .. params.name; | |
end) | |
app:get("/age/:age", function(age) | |
return "You are " .. tostring(age) .. " years old." | |
end) | |
app:post("/", function() | |
return "name: " .. (params.name or 'not sent') | |
end) | |
app:run() |
but it is not a post :/
I'm thinking something like:
curl -X POST -H "Content-Type: application/json" --data '{"username":"ademar","password":"senha123"}' http://127.0.0.1/signin
I think it's a HTTP POST :)
you are trying to send raw data structures (json) to a webservice, I dont recomend in that case (a login, register ...)
see, it should have a variable to assign that structure as follows:
curl --data 'json={"username":"ademar","password":"senha123"}' http://localhost/signin
what i do recommend is that:
curl --data "username=ademar&password=senha123" http://localhost/signin
works :)
but don't need the '-X POST' ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run this with openresty ...
teste with http://domain.name, http://domain.name/xsayarsa, http://domain.name/age/23 ou com POST request
curl --data "name=xsayarsa¶m2=value2" http://domain.name