extjs - Deploy same Javascript webapp build to different environments -


i have extjs application , different environments (local machine, development, production-like test environment, , production). extjs application backed java backend running on either local machine, in development environment, production-like test environment or production environment (not same servers front end application lives though).

for last 2 environments, want build 1 build of extjs app , first deploy test server, when ready release deploy exact same build production server.

question: possible somehow use environment frontend deployed, decide backend extjs should connect to? since extjs front-end executed on client's machine, doesn't know if should connect production backend or test backend.

what best way solve problem this? how (in clean way) javascript web application built , deployed several different environments , communicates corresponding backend application?

how (in clean way) javascript web application built , deployed several different environments , communicates corresponding backend application?

well, case not usual. backend app (at least seemingly) on same server frontend app loaded from. therefore, hassle free way accomplish task make frontend server proxy requests frontend app corresponding backend server. way frontend app still talk origin server allows have 1 build environments.

the "official" way use per-environment sections in app.json file this:

"production": {     "backend": "backend.domain.tld",     // other stuff }, "testing": {     "backend": "backend.testing.domain.tld",     // other stuff }, "development": {     "backend": "backend.dev.domain.tld",     // other stuff } 

the backend value end in build's classic.json (and/or modern.json) file. frontend app see value ext.manifest.backend. way creating different builds wanted avoid. therefore, manually create several versions of classic.json/modern.json files 1 production build this:

  • classic.json.testing
  • classic.json.staging
  • classic.json.production

and use rewriting on frontend server respond "/classic.json" requests whatever json file matches server purpose.

yet another way keep frontend-backend mapping environments within frontend app this:

var env_conf = {     'frontend.testing.domain.tld': 'backend.testing.domain.tld',     'frontend.staging.domain.tld': 'backend.staging.domain.tld',     'domain.tld': 'backend.domain.tld' // production }; 

the app use location.host key , talk corresponding backend.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -