interview/render-2023-10-11/repo/datastore.sh

16 lines
478 B
Bash

#!/usr/bin/env bash
if [[ $# -ne 1 ]]; then
echo "USAGE: ./datastore.sh CACHE_SERVICE_ENDPOINT"
echo "EXAMPLE: ./datastore.sh http://localhost:8080/event"
exit 1
fi
# shellcheck disable=SC2006
for i in `head -n 500 generated-data.json`; do echo "$i" && curl -X POST -H "Content-Type: application/json" -d "$i" "$1"; done
for i in $(tail -n +501 generated-data.json); do
echo "$i"
curl -X POST -H "Content-Type: application/json" -d "$i" "$1"
sleep 1
done