Create POST /{format} endpoint (file.lua)

This commit is contained in:
2020-07-06 20:59:23 +02:00
parent abe02d4f02
commit fde05671d3
5 changed files with 45 additions and 5 deletions

View File

@@ -2,8 +2,11 @@ return {
uri = "/say",
method = Method.POST,
queued = true,
accepts = "application/json",
consumer = function()
tts.say("Hello, world!", "en")
accepts = Mime.JSON,
consumer = function(request)
if(config.silenceMode()) then return end
local body = json.decode(request.body)
tts.say(body.text, body.language or "en")
end
}