Hello, I do a request to exec_controller
and JSONDict.get(str)
is always different, but reply_json(X).
returns the same result. Only if I restart the server, the result will change. I guess it’s cache, but I’m not sure.
I start the server like this:
swipl index.pl
server(8060).
This is the code of a program.
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_error)).
:- use_module(library(http/html_write)).
:- use_module(library(http/html_head)).
:- use_module(library(http/http_client)).
:- use_module(library(http/http_parameters)).
:- use_module(library(http/http_session)).
:- use_module(library(http/http_server_files)).
:- use_module(library(pengines)).
:- use_module(library(http/http_json)).
:- use_module(library(http/json_convert)).
:- use_module(library(crypt)).
:- use_module(library(sha)).
:- use_module(library(http/json)).
:- use_module(library(term_to_json)).
:- use_module(functions).
:- use_module(db_users).
:- use_module(user_module).
:- use_module(admin).
:- use_module(graph).
server(Port) :-
http_server(http_dispatch, [port(Port)]).
stop_server(Port) :-
http_stop_server(Port, []).
http:location(sapi, root(sapi), []).
:- http_handler(sapi(exec), exec_controller, []).
exec_controller(Request) :-
http_read_json_dict(Request, JSONDict), !,
graph:parser(JSONDict.get(str)),graph:graf(_,_,_,G),
term_to_json(G, X),
reply_json(X).