Adds curl test command
This commit is contained in:
24
bootstrap.sh
24
bootstrap.sh
@@ -2,7 +2,10 @@
|
|||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
BOLD='\033[1m'
|
||||||
CHECK="${GREEN}\xE2\x9C\x93${NC}"
|
CHECK="${GREEN}\xE2\x9C\x93${NC}"
|
||||||
|
DEFAULT_MONGODB_URI='mongodb://localhost:127.0.0.1:27017/parse'
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
DEFAULT=$1;
|
DEFAULT=$1;
|
||||||
shift
|
shift
|
||||||
@@ -89,12 +92,18 @@ read -r MASTER_KEY
|
|||||||
|
|
||||||
[[ $MASTER_KEY = '' ]] && MASTER_KEY=$(genstring) && printf "\n$MASTER_KEY\n\n"
|
[[ $MASTER_KEY = '' ]] && MASTER_KEY=$(genstring) && printf "\n$MASTER_KEY\n\n"
|
||||||
|
|
||||||
|
printf "Enter your mongodbURI (%s): " $DEFAULT_MONGODB_URI
|
||||||
|
read -r MONGODB_URI
|
||||||
|
|
||||||
|
[[ $MONGODB_URI = '' ]] && MONGODB_URI="$DEFAULT_MONGODB_URI"
|
||||||
|
|
||||||
cat > ./config.json << EOF
|
cat > ./config.json << EOF
|
||||||
{
|
{
|
||||||
"appId": "$APP_ID",
|
"appId": "$APP_ID",
|
||||||
"masterKey": "$MASTER_KEY",
|
"masterKey": "$MASTER_KEY",
|
||||||
"appName": "$APP_NAME",
|
"appName": "$APP_NAME",
|
||||||
"cloud": "./cloud/main"
|
"cloud": "./cloud/main",
|
||||||
|
"mongodbURI": "$MONGODB_URI"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
echo "${CHECK} Created config.json"
|
echo "${CHECK} Created config.json"
|
||||||
@@ -142,8 +151,13 @@ echo "\n${CHECK} running npm install\n"
|
|||||||
|
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
confirm 'Y' '\nDo you want to start the server now? (Y/n): '
|
CURL_CMD=$(cat << EOF
|
||||||
|
curl -X POST -H 'X-Parse-Application-Id: ${APP_ID}' \\
|
||||||
|
-H 'Content-Type: application/json' \\
|
||||||
|
-d '{"foo":"bar"}' http://localhost:1337/parse/classes/TestObject
|
||||||
|
EOF)
|
||||||
|
|
||||||
echo "\n${CHECK} running npm start\n"
|
echo "\n${CHECK} Happy Parsing!\n\n"
|
||||||
|
echo "${CHECK} Make sure you have ${BOLD}mongo${NC} listening on ${BOLD}${MONGODB_URI}${NC}"
|
||||||
npm start
|
echo "${CHECK} start parse-server by running ${BOLD}npm start${NC}"
|
||||||
|
echo "${CHECK} Test your setup with:\n\n${CURL_CMD}\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user