Skip to content

Commit 0a4cc60

Browse files
committed
Adds curl test command
1 parent b7a723f commit 0a4cc60

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

bootstrap.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
RED='\033[0;31m'
33
GREEN='\033[0;32m'
44
NC='\033[0m'
5+
BOLD='\033[1m'
56
CHECK="${GREEN}\xE2\x9C\x93${NC}"
7+
DEFAULT_MONGODB_URI='mongodb://localhost:127.0.0.1:27017/parse'
8+
69
confirm() {
710
DEFAULT=$1;
811
shift
@@ -89,12 +92,18 @@ read -r MASTER_KEY
8992

9093
[[ $MASTER_KEY = '' ]] && MASTER_KEY=$(genstring) && printf "\n$MASTER_KEY\n\n"
9194

95+
printf "Enter your mongodbURI (%s): " $DEFAULT_MONGODB_URI
96+
read -r MONGODB_URI
97+
98+
[[ $MONGODB_URI = '' ]] && MONGODB_URI="$DEFAULT_MONGODB_URI"
99+
92100
cat > ./config.json << EOF
93101
{
94102
"appId": "$APP_ID",
95103
"masterKey": "$MASTER_KEY",
96104
"appName": "$APP_NAME",
97-
"cloud": "./cloud/main"
105+
"cloud": "./cloud/main",
106+
"mongodbURI": "$MONGODB_URI"
98107
}
99108
EOF
100109
echo "${CHECK} Created config.json"
@@ -142,8 +151,13 @@ echo "\n${CHECK} running npm install\n"
142151

143152
npm install
144153

145-
confirm 'Y' '\nDo you want to start the server now? (Y/n): '
146-
147-
echo "\n${CHECK} running npm start\n"
154+
CURL_CMD=$(cat << EOF
155+
curl -X POST -H 'X-Parse-Application-Id: ${APP_ID}' \\
156+
-H 'Content-Type: application/json' \\
157+
-d '{"foo":"bar"}' http://localhost:1337/parse/classes/TestObject
158+
EOF)
148159
149-
npm start
160+
echo "\n${CHECK} Happy Parsing!\n\n"
161+
echo "${CHECK} Make sure you have ${BOLD}mongo${NC} listening on ${BOLD}${MONGODB_URI}${NC}"
162+
echo "${CHECK} start parse-server by running ${BOLD}npm start${NC}"
163+
echo "${CHECK} Test your setup with:\n\n${CURL_CMD}\n"

0 commit comments

Comments
 (0)