Kapow with resources as endpoints

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-04-26 07:32:55 +02:00
parent fae7a4034b
commit 20460623d7
8 changed files with 524 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/zsh
tmpfile=$(mktemp --suffix=.pdf)
pandoc --from=$(request /match/from) --to=pdf --output=${tmpfile} -t latex =(request /body)
if [ $? -eq 0 ]; then
cat ${tmpfile} | response /body
echo "application/pdf" | response /header/Content-Type
echo 200 | response /status
else
echo 500 | response /status
fi
rm -f ${tmpfile}