New-style kapow on project root.
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
touch input
|
||||
touch output
|
||||
tail -F input | tr '[:lower:]' '[:upper:]' > output &
|
||||
|
||||
|
||||
kroute add -X POST --entrypoint /home/nil/Project/kapow/kapow2/examples/topdf '/convert/{from}/pdf'
|
||||
|
||||
|
||||
kroute add -X POST --entrypoint /bin/zsh '/convert/{from}/{to}' - <<-'EOF'
|
||||
pandoc --from=$(request /match/from) --to=$(request /match/to) --output=>(response /body) =(request /body)
|
||||
EOF
|
||||
|
||||
kroute add -X GET '/formats/input' - <<-EOF
|
||||
pandoc --list-input-formats | response /body
|
||||
EOF
|
||||
|
||||
kroute add '/formats/output' - <<-EOF
|
||||
pandoc --list-output-formats | grep -v pdf | response /body
|
||||
EOF
|
||||
|
||||
kroute add '/tail' - <<-EOF
|
||||
tail -f /tmp/mispelotas | response /stream
|
||||
EOF
|
||||
|
||||
kroute add -X POST '/tr' --command '
|
||||
request /body >> input
|
||||
tail -n1 output | response /body
|
||||
'
|
||||
Executable
+12
@@ -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}
|
||||
Reference in New Issue
Block a user