tarantool / nginx_upstream_module

Tarantool NginX upstream module (REST, JSON API, websockets, load balancing)
Other
174 stars 18 forks source link

New response form #59

Closed monopolly closed 7 years ago

monopolly commented 8 years ago

Will be super to get a strong answere format from nginx

Just to return a 3 fields always:

answere looks like:

//error
{
    "result":false,
    "error":{
        "code":405,
        "message":"You got an error"
    }
}

//multi response
{
    "result":true,
    "body":[
        {"Answere 1 from tarantool"},
        {"Answere 2 from tarantool"},
        {"Answere 3 from tarantool"},
        ]
}

//single response
{
    "result":true,
    "body": "Answere 1 from tarantool"

}

so parser will be very simple and understandable

if result then print(body) end
if not result then print(error) end

so clear and simple and not necessary to write a complex parser depends on nginx answeres) thanks!

and you'll not need a tnt_pure with this it will be pure answere always

dedok commented 7 years ago

Check v2.4.6-rc1. (https://github.com/tarantool/nginx_upstream_module#http-headers-and-status)