How to specify a different domain when using sencha app watch? - extjs

Is there something like?
sencha app watch --host=mydomain.app
As we all know, the default domain is localhost:1841. I can define a custom port, but not a custom domain.
I haven't found anything related in the Sencha documentation. Any workaround? I need to serve on a custom domain to avoid cross domain CORS issues.
Thanks.

According to the documentation of Sencha Cmd you can:
Change the default address in sencha.cfg by setting inspector.address property.
Use the config command of Sencha Cmd to set a server and port:
sencha config --prop inspector.address=http://server:port/ \
then \
app watch --inspector

Related

How to support react js app for 2 different sub domains

I am a bit struggle with support to a react js to support 2 different subdomains. Followings are the subdomains I need my app to support
www-dev.somedomain/apps/myapp
app-dev.somedomain/myapp
As you can see, react-app-path is also changing with the subdomains. I have defined PUBLIC_URL and REACT_APP_PATH in my .env file as below.
REACT_APP_PATH=/myapp
GENERATE_SOURCEMAP=false
PUBLIC_URL=/myapp
With above env vars app-dev... URL is working. If I change to the path to apps/myapp then www subdomain in working. I need a way to support both subdomains at once
How can I achieve this?
Finally, I solved this problem with the following steps; I was using Nginx to be redirected to the same host. The problem I have was with the paths.
www-dev.somedomain/apps/myapp
app-dev.somedomain/myapp
According to my Nginx configurations, both URLs were redirected to / in the server. Then the app couldn't find the static files because paths were different with domains. So to fix this, I did as below.
First, remove PUBLIC_URL from my env file. Then app files will be hosted at the / location
Added homepage attribute to package.json file. adding homepage will serve assets relative to index.html. Read more about homepage. Using `"homepage"` in package.json, without messing up paths for localhost
Since the app is using internal routing, I added simple Nginx rule to rewrite the location of static files as below.
rewrite /static/(.*)$ /static/$1 break;
This solved my problem with supporting two doamins.
No way, Your React app will be compiled into static HTML, JS, and CSS files, and the only time you can pass parameters to the build tool is before building, which is what you're doing right now. Once the building is complete, it can't be changed.
You can write two shell script, with different environment variable. Then invoke each of them will build different web app.

Not using 'localhost' in HOST for development with create-react-app

My problem is quite simple: I would like to avoid using localhost at the end of my HOST env variable with create-react-app. However it seems that if the URL doesn't end with .localhost, the script will try to resolve the URL against a DNS server.
I would like to avoid that and just use the same URL domain as my backend server is using, to avoid CORS problems (and I wish not to configure my backend to allow CORS because that's not how the production infrastructure is).
Thanks :)
If you want to use some custom domain locally, without resolving it agains a DNS server, you can add that domain to your hosts file.
Location of hosts file on Windows:
C:\Windows\System32\drivers\etc\hosts
Location of hosts file on Mac:
/etc/hosts
You can modify the hosts file by adding the following line to it:
127.0.0.1 yourcustomdomain.com
This will bind yourcustomdomain.com to your local IP. Now you can use yourcustomdomain.com in your create-react-app.
The true problem you're facing here is CORS. The standard solution for this is actually to just proxy your request, so that they're hitting from the same origin. Webpack has a clean way to do this. See this blog by facebook: https://facebook.github.io/create-react-app/docs/proxying-api-requests-in-development
This has gotten incredibly easy to do now. All you need to do is add a proxy field to your package.json. For example -
"proxy": "http://localhost:4000",

modifying dotnetify react js to use in cordova application (change path of dotnetify.react.connect)

I am using React app that wraps DotNetify around Cordova to build iOS and Android app.
Dotnetify connects to a WebSocket Server at given URL, we need to define based on build web or Cordova what is the host URL to connect to the Socket/SignalR server, current line is:
dotnetify.react.connect('Login', this);
the definition of Login is actually relative and I need to pre-pend the host URL somehow to tell build where is the WebSocket to connect to.
My assumption is it should be defined somewhere in Package.json to make it look like below:
dotnetify.react.connect('WSS://DEV.DOMAIN.COM/'+'Login', this);
What's the best solution to address this issue for development/debug mode locally or development on a server with public static IP or production server.
I have found base_url that needs to be passed in info object: node_modules/socksjs-client/lib/main.js:183
// allow server to override url used for the actual transport
this._transUrl = info.base_url ? info.base_url : this.url;
So based on above I tried to pass argument, but donetify is not passing this argument to the socksjs. how do we fix this actually?
this.vm = dotnetify.react.connect('Login', this, {"base_url":"wss://dev.domain.com"});
You can use below to set below in your index.js to set the host right before connecting line.
dotnetify.hubServerUrl = 'domain.example.com';

Setting variables per environment electron-react app

its the first time i do electron app,
this app need to do API calls to lets say:
http:/<baseUrl>/someAPI
I need to change this "baseURL" on build somehow.
(can be anything...)
and cant use System.env when app is build.
i am using electron builder
I am thinking about creating a script and adding it to "package.json",
any thing more simple?
Thanks!
you can use proxy in package.json
Example
"proxy": "http://example.com"
so in each HTTP request will assign this proxy in the URL.
or you can use this package electron-proxy-agent

HTML5Mode, AngularJS and Grunt Build Control

Hoping someone can answer this because I'm struggling...
I have an angular js app that was build with the yo-angular generator. All works fine with deploying through grunt build control, as long as I'm not using the #-free "html5mode."
However, once I enable html5mode to remove the # from my routing and then deploy, my app on github pages doesn't point to the correct source for its scripts and such... For instance, I'm getting a 404 error because it's looking for http://{{user name}}.github.io/scripts/{{name of file}}, instead of http://{{user name}}.github.io/{{app name}}/scripts/{{name of file}}
How can I get it to point to the correct directory?
Hope this makes sense. I'll share more if needed!
You also need to configure the server. The configuration change will depend on what technology you are using to host the app on the server. How to configure your server to work with html5mode

Resources