We are using for the TypeScript development VS Code or IntelliJ IDEA.
Open three terminal windows
firebase login to the jh@jobelhome.com account
firebase use dev Specify the Firebase environment you want to use [jh@jobelhome.com]
yarn emulate - Start Firebase emulator with Firestore and Cloud Functions
yarn start:win - Start React localhost on windows
yarn start:mac - Start React localhost on mac
yarn watch - Start live conversion from Typescript into JavaScript
windows: yarn initConfig - Import the config data to the database, wait with this until the emulator setup is complete (1.st step)
mac: cd functions --> yarn initConfig:emu
Call the refreshBooking Cloud Function to download the booking data : http://127.0.0.1:5001/jobelhome-test/europe-west1/refreshBooking
Go to a random booking in your local Firestore and copy a bookingId: bookings ➡️ bookings ➡️ random id
Call redirectToRegistration Cloud Function with bookingId http://127.0.0.1:5001/jobelhome-test/europe-west1/redirectToRegistration?bookingId=#your booking id
This will redirect you to the website if successful with the necessary data
To call the registrate function click on the submit button
To view the Cloud Function logs open the Firebase Emulator UI
http://127.0.0.1:4000/logs
For API test we are using Postman. To log in please us the jh@jobelhome.com Google account and choose the Google authentication. (use a separated Chrome profile!!!)
In order to debug a cloud function or any other logics in the Webstorm, do the following:
Run the emulator with debug mode ($ yarn debug)
You should see something like this in the logs => (Debugger listening on ws://127.0.0.1:9229/20b7a32e-5912-43bc-a26a-aac8a0e16a6d)
In the Webstorm IDE, open Run Configurations
Click + button.
Add "Attach to Node.js/Chrome"
Set the Host and Port (as printed in the log)
Click on the OK button
Put a breakpoint on the line that you want to debug
Run the configuration with Debug (the bug icon next to run)
Call the logic that you want to debug, it should stop where the breakpoint is placed