Updated readme, added devel folder with tests and setup/development manuals

This commit is contained in:
MrFry 2020-03-19 17:35:04 +01:00
parent c71eabf54f
commit 0c5ab62a5c
10 changed files with 218 additions and 4 deletions

52
devel/tests/testScripts/ask.sh Executable file
View file

@ -0,0 +1,52 @@
#!/bin/bash
url=$(head -n 1 ../serverAddress)
echo "Server url: $url"
simpleType='\{"type":"simple"\}'
q=$1
data=$2
subj=$3
if [ "$#" -lt 2 ]; then
echo "min 2 params required"
echo "Params can be:"
echo "question data subj"
echo "question subj"
exit 1
fi
if [ "$#" -eq 2 ]; then
data="$simpleType"
subj=$2
elif [ "$#" -eq 2 ]; then
data=$2
subj=$3
fi
../bin/hr.sh
echo sending
echo "Question: $q"
echo "Data: $data"
echo "Subject: $subj"
q=$(node -e "console.log(encodeURIComponent('\"$q\"'))")
if [ "$?" -ne 0 ]; then
echo "node error!"
exit 1
fi
subj=$(node -e "console.log(encodeURIComponent('\"$subj\"'))")
if [ "$?" -ne 0 ]; then
echo "node error!"
exit 1
fi
echo "Result:"
../bin/hr.sh
res=$(curl -L -s -X GET "${url}/ask?q=${q}&data=${data}&subj=${subj}")
echo "$res" | jq
if [ "$?" -ne 0 ]; then
echo "jq error"
echo "$res"
fi
../bin/hr.sh