This module is primarily for BFF (Backend For Frontend). This module is working as a bridge between Query processing engine and Frontend. It also publish result to the query history dispatcher module so that users can see other people's query at run time.
flask-restful is used to build the api end points. As a data source Postgres is used as it is free.
This project needs on the following dependencies,
Api end point is stated below ,
- Url: http://169.45.107.190:5000/queryhandler/ ( Example endpoint; Deployed in Koding VM )
- Method: POST
- Example:
tareqsust@tareq:query-handler$ curl -i -H "Content-Type: application/json" -X POST -d '{"text":"tour cost employee"}' http://169.45.107.190:5000/queryhandler/
Content-Type: application/json
Content-Length: 109708
Server: Werkzeug/0.11.4 Python/2.7.6
Date: Mon, 22 Feb 2016 06:19:01 GMT
{
"data": [
{
"age": 71,
"costperperson": 6900.0,
},
..........
]
}Here is an sample of the Ajax request,
$.ajax({
type: "POST",
url: "http://169.45.107.190:5000/queryhandler/",
contentType: "application/json",
data: JSON.stringify({"text":"tour cost employee"}),
dataType: "json",
success: function(responseData) {
console.log(responseData);
},
error: function(err) {
console.log(err);
}
});