unigui作中间件使用

可返回string或者tstream数据。

如果返回JSON字符,则UNIGUI就是REST 中间件。

procedure TUniServerModule.UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean);
var
cmd, sql: string;
begin
cmd := ARequestInfo.URI;
if Pos('query', cmd) > 0 then
begin
sql := ARequestInfo.Params.Values['sql'];
if sql <> '' then
begin
Handled := true;
AResponseInfo.CharSet := 'UTF-8';
AResponseInfo.ContentType := 'UTF-8';
AResponseInfo.ContentText := 'unigui中间件';
end;
end;
end;

浏览器打开 URL:http://127.0.0.1:9999/query/?sql=select * from tgoods

unigui作中间件使用

 

 



相关文章:

  • 2022-02-10
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案