Deploy API-Server & Mobile App in Production

Api Server

Installation Steps

Step 1: Clone Native Starter Pro app

Step 2: Goto Api-Server folder and install node_modules by npm i.

Step 3: Run npm run build

Step 4: Export node environment by export NODE_ENV=production.
Do check if it is set by echo $NODE_ENV it prompts as production.

Step 5: Run forever now by forever start dist/index.js.
Check if forever is running by entering forever list.


Common issues npm ERR! bcrypt

You need to enter npm install --save bcrypt-nodejs && npm uninstall --save bcrypt


Mobx-Starter-App

Installation steps

Step 1: Goto NativeStarterPro/Mobx-Starter-App

Step 2: Now change the url and port number. Goto js/config.js and change the root to

root: 'YOUR_IP:PORT/api',
port: 3030 //incase of running api-server (node app) in production
port: 443 //incase of running api-server (node app) on heroku

Step 3: Make sure you have an Expo account.

  • To publish on Expo and get the Expo link

    Goto NativeStarterPro/Mobx-Starter-App and run exp publish

  • To build standalone app

    • Configure app.json

      To configure this, update the default app.json and add the various values that you will need to build standlone app(apk & ipa).

    • Start the build

      Run exp start in your app directory to boot up the Expo packager. This is necessary because during the build process your app will republish to ensure it is the latest version.

      • Build for Android: Once the app has started, run exp build:android

      • Build for iOS: Once the app has started, run exp build:ios

    • Wait for it to finish building

      This will take a few minutes, you can check this by running exp build:status. Once this is completed, you can find url of .apk (Android) or .ipa (iOS) file — This is your app.


Note:

  • Follow Mobx-Starter-App procedure, in case if you want to deploy for Redux-Starter-App.

results matching ""

    No results matching ""