For Route42.
Data access API for providing flexible access to Firebase backend data store.
- Pull the latest version of our Android app from the
dev
branch. - Go to package
com.comp6442.route42.api
and editRestApiService.java
.- In the line
String url = (BuildConfig.EMULATOR) ? "http://192.168.0.2:8080/" : "http://13.211.169.204:8080/";
the192.168.0.2
part must be changed to your local IP address. - If you're using Mac, execute
ifconfig | grep "192.168."
in your terminal, and you will find your local IP address next to the wordinet
in the printed result.
- In the line
- You are now ready to run the mobile app and connect it to a REST API running on your machine.
Run REST API locally on your machine, execute the following command in the terminal (if you're using Mac) inside the project root directory:
FIRESTORE_EMULATOR_HOST=localhost:8080; GOOGLE_APPLICATION_CREDENTIALS=./google_application_credentials_route42.json ./gradlew bootRun
Testing GET (Try to test locally instead of using the production api)
curl --request GET localhost:8080/post/0092827e-2961-48ed-8995-50adb9f47781
# curl --request GET http://13.211.169.204:8080/post/0092827e-2961-48ed-8995-50adb9f47781
Testing POST request
curl --header "Content-Type: application/json" \
--request POST \
--data '{"query":"username: moniquechan"}' \
localhost:8080/search
curl --header "Content-Type: application/json" \
--request POST \
--data '{"query":"username: moniquechan and hashtags: #love #instarunners #triathlon"}' \
localhost:8080/search
curl --header "Content-Type: application/json" \
--request POST \
--data '{"query":"(username: moniquechan and hashtags: #love #instarunners #triathlon) or username: miranda45"}' \
localhost:8080/search
curl --header "Content-Type: application/json" \
--request POST \
--data '{"query":"(username: moniquechan and hashtags: #love #instarunners #triathlon) or username: miranda45"}' \
http://13.211.169.204:8080/search