Models with CodeRunner¶
CodeRunner lets you control what model the code is deployed to. When you download the Cloud Code from the Backendless Console, the generated project is already configured for the deployment model where the code is declared. For example, suppose an event handler is created in the "validator" model, then the downloaded project will reference the model in the coderunner.json
file:
"app": {
"id": ...,
"apiKey": ...,
"model": "validator",
"exclude": [
....
]
}
. The referenced model is used when the code is either debugged locally or deployed to production.
When the code is being deployed to the Backendless servers, any other previously code in the same mode will be removed and replaced by the current deployment. CodeRunner informs about it with the following message:
IMPORTANT!
The business logic code will be deployed to model "MODELNAME".
Any business logic which is already deployed on the server in that model
will be removed and replaced with the code from your current project.
If this is an undesired behavior, stop now and set a different deployment model
either by using the --model argument or changing the model name in coderunner.json.
Would you like to continue? (Y/N)
Use the --model argument to change the name of the deployment model without modifying the configuration file:
npm run deploy -- --model YOUR-MODELNAME