Where to write backend code in Expo and make sure it works in Expo Go - react-native

What would be the conventional way to write backend code in Expo? For example, have two directories - client and server at the root as below:
ROOT
|-Server
| |_backend files here (ex.Express)
|
|-Client
| |_frontend files here (Expo files)
|
If so, when I publish the project to Expo Go by running the command in the Client directory, how would Expo pick up my backend code in the Server directory?
My goal is to have the project on Expo Go connected to the backend.

Since you're talking about using Express, which is a web server framework, you would basically never distribute this with the client app. It would be deployed separately, and called from the frontend over a network connection.
Having a separate backend, or server, allows you to make it a shared resource. Imagine a shopping app where you had to update the app each time you wanted to see new products - it wouldn't be practical. With a shared backend, you can have a centralized database, or a way to distribute content without updating the app each time, for example. This - commonly called client-server architecture - is the most common pattern in business development today.
This article on client-server architecture might be helpful. https://cio-wiki.org/wiki/Client_Server_Architecture

I am not familiar with Expo. But it sounds like Expo is only taking care of the client/app parts of a full stack application.
In this case I would suggest to have two different repositories, one for the client/app and one for the backend.

Related

How to create a shopify app dev environment

I'm building an embedded shopify app and I struggle to test it as embedded app because it's veeeery slow. I started my app following the official guide of creating an app with node & nextjs and I'm still using both but i'm considering getting rid of nextjs and using just react since it feels veeery slow and so heavy for ngrok to transfer all the files to the shopify iframe...
What would you recommend to work smoothly with shopify when building an embedded app?
(I'm mostly working locally but I still need to often go check that it works well inside the admin & to use shopify-app-bridge library)
if ngrok is slow for you, i would suggest heroku for deployment and testing,
create new application at heroku, you can also connect it with your github and use automatic deploy when you push your code

How to import apps in another app with Vuejs

I would like create many indenpendants applications with a master application.
Without going into too much explanation...
The master is the layout and functionnal core
Apps are the contents in the master.
Contrainsts :
Each applications and the master app must be have a independant repository & can be launch (master and app too) separatly.
The core must called all applications
i would not use iframe for called applications.
I need to :
* getting all routes of all applications
* Share fonctionnal code between apps and master
What is the best approach ?
Applications are in npm packages + lerna (or other) ?
Applications are build or keep dev sources in package folder ?
Applications are vuejs plugins ?
architecture type
Thanks for your answers :)
There is no silver bullet for this, but as a best practice and way to go, you should look toward micro frontend architecture with separate package per app + one infrastructure / common package.
Here is a good place to start: https://micro-frontends.org/

How to separate debug and release builds with respect to their api destinations in React Native

Originally I ran a local server on my PC in order to make my django REST api available for my React Native app to reach out to through my computer's ip. So I had a base url hardcoded into my js network utilities as http://10.0.0.xxx:8000/api/ which I used as the basis for all my network calls. Recently I deployed my backend to Heroku so that I could demonstrate my app when away from my computer. So for now I just made a second hardcoded base url of https://my-cool-app.heroku.com/api/ which I manually flip back and forth between in my js code depending on if I want to use my local server (for debugging while devving) or the remote server for demonstration (and by "manually flip back and forth", I mean I literally change my code to point to one or the other).
I understand this is a terrible way to go about things and that I'm missing some major pieces to the puzzle that probably apply not just to RN projects but to most full stack projects where the frontend and backend are not hosted on the same server. I know I can look for the __DEV__ flag to see if I'm working in a debug or release version, but then would I have to keep two versions of the app on my phone somehow? Also, does it even make sense to keep my base urls hanging around on the front end, or should they be dispensed from the backend in some way instead?
I personally use :
https://github.com/zetachang/react-native-dotenv
for my environment variables like my backend api and other configs based on the env.
Since it's similar to many backend libs like django or laravel, i absolutely love this library for managing environment variables :)

React native, do I need to send updates through app store?

Title pretty much explains it. Does it render JS from an external codebase so I can simply push new updates through git, or do I need to actually push the changes through App Store?
This is my previous answer, which is getting downvoted into oblivion because it didn't predict something cool like CodePush coming to React Native :)
React Native compiles to an iOS binary. Updates need to be sent to the
App Store, unless you're simply using React Native for its WebView
and rendering an existing webpage on the client.
Updated 6/2/16
It looks like Microsoft has a sweet plugin for CodePush found here that lets you push changes remotely to your React Native app without having to send the update through the App Store.
Here's a quote from the README docs:
NOTE: While Apple's developer agreement fully allows performing
over-the-air updates of JavaScript and assets (which is what enables
CodePush!), it is against their policy for an app to display an update
prompt. Because of this, we recommend that App Store-distributed apps
don't enable the updateDialog option when calling sync, whereas Google
Play and internally distributed apps (e.g. Enterprise, Fabric,
HockeyApp) can choose to enable/customize it.
I'm actually working on a project (with the React Native Playground team - https://rnplay.org/about) that will allow you do live update your apps JS on the fly without submitting an update to the App Store. It's called Reploy, http://reploy.io
We will be open-sourcing the first portion of it very soon (the updater module). There will also be a service that will help you to manage your updates and even deploy your app to TestFlight and the App Store when needed (App Store updates are still needed when adding a new native module or static assets).
Also, just so you know, Apple has allowed this type of auto-updating via item 3.3.2 in the "iOS Developer Program Requirements" document, it says:
3.3.2 An Application may not download or install executable code. Interpreted
code may only be used in an Application if all scripts, code and interpreters are
packaged in the Application and not downloaded. The only exception to the
foregoing is scripts and code downloaded and run by Apple's built-in WebKit
framework or JavascriptCore, provided that such scripts and code do not change
the primary purpose of the Application by providing features or functionality that are
inconsistent with the intended and advertised purpose of the Application as
submitted to the App Store.
https://developer.apple.com/programs/ios/information/iOS_Program_Information_4_3_15.pdf
You could push an update to a remote user if you had linked to an external bundle and had the IP / correct ports forwarded, however Apple do not allow this for released AppStore apps.
For beta testing remote apps you might want to try exponent http://exp.host/
Update---
For completeness, it should be noted that if you are part of the Apple Enterprise program you do not need to publish Apps to the AppStore at all, you can post them to end users via a download link.
I work on a project called AppHub that lets you update JavaScript and images without re-submitting to the App Store. The iOS SDK will be open source, but for now you can use the hosted service to manage new builds of your app.

IBM Worklight - How to customize an app after creating its .api/.apk?

I wish to distribute my enterprise Worklight application to many different clients.
Basically what I want to do is give my customer the .ipa and .apk files of the Worklight app so that they may upload them onto their own Application Center. The problem is that each application needs to be slightly different in that there are different URLs they must refer to as well as some other properties such as text.
I was wondering if there's a way to have my ipa/apk read from a properties that my client could change on their own without having to rebuild the ipa/apk?
EDIT for clarification:
The application I'm referring to is NOT the Application Center app, it is an application I've built using Worklight that I would like to distribute using the Application Center. I will be selling my application to entire companies rather than single users. Once the company has the application, their employees will need to download it somehow (using the Application Center I'm hoping).
Right now I'm trying to figure out exactly how I will distribute my application to my clients. My application calls services of another application hosted on another server (aka the "URL" I was referring to before, it is NOT the Worklight URL). The problem is this URL will be different per client and as far as I know right now in order to change this URL per client, I must recompile the ipa/apk for each client. This is what I'd like to avoid. If possible I would like to distribute the same ipa/apk to each client and have them change some sort of parameter somewhere to set the correct URL for their environment. It's also important to note this URL does not go through an adapter, and lives directly in the client.
IMO what you are asking for is not possible, be it with a regular native app or a Worklight hybrid app (that is really a web app but enclosed in a native "shell").
Once you produce the .ipa or .apk file, it is closed and cannot (unless cracked) be opened to make changes (that would be a security breach). Using a "properties file" next to the app is obviously not possible either.
You will need to create a custom .ipa/.apk for each customer.