pandoc-cgi:

Remove /batch endpoint; instead, behave differently if
passed an array of JSON objects.

Rename multidingus endpoint to babelmark.
This commit is contained in:
John MacFarlane 2022-08-07 19:31:00 -07:00
parent 18484cbf47
commit 6b9da0cc96
2 changed files with 6 additions and 6 deletions

View file

@ -41,11 +41,11 @@ $(deriveJSON defaultOptions ''Params)
-- Get requests with either plain text or JSON, depending on the
-- Accept header.
type API =
"convert" :> ReqBody '[JSON] Params :> Post '[PlainText, JSON] Text
ReqBody '[JSON] Params :> Post '[PlainText, JSON] Text
:<|>
"multidingus" :> ReqBody '[JSON] Params :> Post '[JSON] Value
ReqBody '[JSON] [Params] :> Post '[JSON] [Text]
:<|>
"convert-batch" :> ReqBody '[JSON] [Params] :> Post '[JSON] [Text]
"babelmark" :> ReqBody '[JSON] Params :> Post '[JSON] Value
:<|>
"version" :> Get '[PlainText, JSON] Text
@ -57,11 +57,11 @@ api = Proxy
server :: Server API
server = convert
:<|> multidingus -- for babelmark
:<|> mapM convert
:<|> babelmark -- for babelmark which expects {"html": "", "version": ""}
:<|> pure pandocVersion
where
multidingus params = do
babelmark params = do
res <- convert params
return $ toJSON $ object [ "html" .= res, "version" .= pandocVersion ]

View file

@ -167,7 +167,7 @@ function newpage() {
let params = { from: from, to: to, text: text, standalone: standalone };
// console.log(JSON.stringify(params));
fetch("/cgi-bin/pandoc-cgi/convert", {
fetch("/cgi-bin/pandoc-cgi", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify(params)