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
Related
I have been messing with Phaser 3 lately and would like to upload my game on a website. I know firebase offers hosting which is free so I wanted to try that out. I successfully setup everything on the firebase side using the firebase-cli. My phaser project uses a webpack config. When I test my phaser game locally using "firebase serve" it doesnt load the phaser code at all. On the other hand it works perfectly with "yarn dev". Has anyone had any experiance deploying a phaser app on firebase hosting? I did some reasearch but didnt really find out much about that topic. Any help is appreciated.
I setup firebase hosting with firebase-cli but when testing the game locally via firebase-serve the website doesnt load anything related to phaser.
EDIT: Also I get no errors whatso-ever which makes this even more confusing
Make sure you upgrade firebase to the blaze plan, which doesn't charge you but allows one to use third party libraries, otherwise it won't function because firebase will inherently block your third party requests api requests. the blaze plan will require a credit card or debit card on file, but if one is careful one should for all intents and purposes be able to operate free or close to free for a very long time.
firebase deploy --only hosting
firebase deploy --only functions
I found a solution to my Problem. Basically, I had set up my webpack wrong. For anyone looking to get into Phaser 3 Development, I'd suggest you check out Yannick's template that works with phaser+webpack+typescript. Here is the link: https://github.com/yandeu/phaser-project-template . It also is pretty up-to-date which is awesome!
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.
I am posting this question in the lack of tutorials available for nwjs app development. Also, documentation in not much of a help. There are a few YouTube tutorials but they are 4-5 year old. Since then Node-webkit has changed into nwjs and now available in two different flavors. None of those tutorials are helping because they are based on old node-webkit and none of them answers any of my questions below. -
Let me break the title question into parts -
Which version should I used for making nwjs based desktop app? Regular or SDK?
How to make nwjs desktop app?
What would be the app/folder structure?
How to use node module with nwjs?
How to make use of route in nwjs app? Or do I need route at all?
Question 1. Which version should I should of nwjs? Whatever I have read online, found that nwjs sdk is best bet because it allows to debug the app during development, which fairly answers my this question.
Question 2. How to make nwjs desktop app? I found another SOF post where one example has been given in an answer to create basic app - Here Though, example is pretty straight forward but I still have few confusion which I need clarification so I am gonna ask them in the next question below.
Question 3. What would be the ideal folder structure for nwjs app? I have this folder structure right now in my nodejs app.
**Main App
|__app/
|__backend/
|__bigtable/
|__pubsub/
|__config/
|__client.json
|__models/
|__database-models.js
|__node_modules/
|__public/
|__css
|__js
|__img
|__libs
|__routes/
|__auth-routes.js
|__app-routes.js
|__api-routes.js
|__views/
|__index.ejs
|__login.ejs
|__*.env
|__package.json
|__package-lock.json
|__server.js
I don't know if can take this exact folder structure into nwjs, if yes? then How? if no, then how can I restructure my app for nwjs. What are the parts of the code that I need to restructure or redistribute or reintegrate in the app? As shown in the example in the above link server.js has been attached in the html file, why? What I have learned from developing nodejs app is that you need to run server.js and go to the localhost:port# in browser. This all had made me confused to develop nwjs app. Basically require doesn't work in browser but it does in nwjs
Question 4. How to use nodejs module in nwjs app? I know that nwjs creates its own local server and runs the app. You don't need to make express server or http server separately which runs on by default 8080 port. In the examples provided in the above link, uses express server which runs on 3000 port. Why do you need to create express server? Why can't we use default server which runs on 8080? Do I really need to use express module to use other nodejs modules (non-inbuilt modules)?
Question 5. Making use of routes in nwjs app?
case 1 Let say if we can use default server then how can I utilize that to create routes to make front end interact with modules.
case 2 Let say if we need express and we are attaching server.js into html file then do we need routes?
Extra I have also read that we can directly call node_modules from html then do we need express? do we need routes then? How can we secure code in nwjs? How can I package nwjs app for distribution with source code protection?
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 :)
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.