WEB and MOBILE application with a fake REST-API.
$ git clone https://github.com/danielmesquitta/ecommerce && cd ecommerce
# Go to the correct folder
$ cd server
# Open package.json with your code editor.
$ code package.json
Now, you will need to update the start script host according to your wifi ip:
"start": "json-server --host <YOUR_WIFI_IP> server.json -p 3333"
After this, you can go back to the terminal, still in the server folder and do the following:
# Install the dependencies
$ yarn
# Start
$ yarn start
# Go to the correct folder
$ cd web
# Open api.ts with your code editor
$ code src/services/api.ts
Update the server wifi ip.
baseURL: 'http://<YOUR_WIFI_IP>:3333'
# Install the dependencies
$ yarn
# Start
$ yarn start
# Go to the correct folder
$ cd mobile
# Open api.ts with your code editor
$ code src/services/api.ts
Update the server wifi ip.
baseURL: 'http://<YOUR_WIFI_IP>:3333'
# Install the dependencies
$ yarn
# Start
$ yarn android
# If it doesn't start automaticaly, just run the following and reopen the app
$ yarn start
The last step is to connect the app with the server.
Open the react native developer menu on your emulator/phone, click on Settings, than Debug server host & port for device and type your wifi ip according to the following: <YOUR_WIFI_IP>:8081
Now You can confirm and reload the app