Run Mode

Run Mode

Run Mode

Function

app.mode Controls how bt_app prepares resources, executes scripts, and loads window entries. Currently only static, server, and remote are supported.

Compare

ModeEntry exampleWhether local service is requiredWhether it is suitable for packagingSuitable for scenarios
staticindex.htmlNoYesPure static pages, gadgets, local resource applications
YesBT backend plus Web front-end desktop application
remotehttps://example.comNoYesRemote Web, SaaS management tool, cloud page shell

static

static mode reads project resources through bt://app/....

The advantage is that it is simple to deploy and does not need to start the local web service after packaging. The disadvantage is that the page cannot rely on the browser server environment characteristics. For example, server-side routing needs to be handled by the front-end itself.

server

server mode first executes server.bt in the project root directory, and then opens the HTTP address specified by app.entry.

server.bt Example:

The advantage is that you can use the full BT Web service capabilities. The disadvantage is that the port must be managed, and the startup will fail if the port is occupied.

After modifying server.bt or related resources while the development directory is running, bt_app will first stop the old web service, then re-execute server.bt and refresh the window. When modifying the listening port, app.entry needs to be modified simultaneously, otherwise the window will still open the old address.

remote

remote mode directly opens the remote URL:

In remote entry mode, the software shell itself can remain stable, and the business page is deployed on the server side. After the developer updates the server content, the user can use the new version of the app again and does not necessarily need to re-download and install the client.

The current version of the remote page will also inject window.bt and window control capabilities, and only trusted remote pages should be loaded.

server.bt automatically executes

In addition to server mode, as long as server.bt exists in the project resources, the current runtime will also try to execute it. If a normal static or remote project does not require local services, do not place useless server.bt.