Closed matchaxnb closed 3 months ago
Salut Gilles,
I just added a JSON output capability to your project to be able to use it as a service. In order to leverage this feature, you just need to call the website as follows:
curl --no-progress-meter \ https://your.host -X POST -H 'Content-type: application/json' \ -d '{"content": "SELECT 1;"}' -H "Accept: application/json" | jq -r '.formatted' SELECT 1; curl http://your.host -X POST -H 'Content-type: application/json' \ -d '{"content": "SELECT 1;"}' -H "Accept: application/json"; {"formatted":"SELECT\n 1;\n\n"}
This makes it easily integrated to other services and is the purpose why I use that.
I also included a Dockerfile for CGI to easily test that feature.
Build and run it using:
docker build -t pg_formatter -f cgi.Dockerfile . docker run -p 8080 --name pg_formatter --rm pg_formatter
You may disable this feature by setting the configuration parameter "enable_api" to 0, similar to how you enable or disable debug.
I hope you find that useful and merge it :)
à la prochaine
Great feature, thank you.
Salut Gilles,
I just added a JSON output capability to your project to be able to use it as a service. In order to leverage this feature, you just need to call the website as follows:
This makes it easily integrated to other services and is the purpose why I use that.
I also included a Dockerfile for CGI to easily test that feature.
Build and run it using:
You may disable this feature by setting the configuration parameter "enable_api" to 0, similar to how you enable or disable debug.
I hope you find that useful and merge it :)
à la prochaine