Skip to main content

Local debugging

You can start the service locally and access the online service for debugging.

To complete this tutorial, you need to complete the following steps:

1. Log in to the specified domain name

Use the login command(please refer to: Login. Log in to the specified domain name server.

giteeteam-apps login

login_app

2. Build app

Build app and the output is *.zip

yarn build-app

The build-app command is already defined in package.json.

3. Publish application (development environment)

Deploy the application package built in the previous step.(please refer to: Deploy)

giteeteam-apps deploy xxx.zip
tip

The default is the development environment application, and the application published from the application market page is the production environment application.

4. Subscribe to the application

Go to the developer center page http://{domain}/apps/page/application/developer

domain is the domain name you logged in to.

The subscription method is the same as the Deploy in the application market.

developer_page

5. Run the front-end project locally

Run the command to start the local project:

yarn dev

The dev command is already defined in package.json.

6. Debugging with tunnels

6.1 Use the tunnel command(please refer to:Tunnel)to enable local debugging。

giteeteam-apps tunnel

tunnel

6.2 After enabling the tunnel, you also need to add APPS_ENABLE_LOCAL_DEV=true to LocalStorage of your local browser,

apps-enable-local-dev

6.3 Then you can directly debug local front-end code on the online service:

fontend_debug

6.4 Accessing the online webtrigger can also debug the local function code:

POST http://{origin}/apps/api/v1/:tenant/apps/workspace_page_demo/environments/development/webtriggers/:webtriggerKey

production vs staging vs development

There are three environments for applications, and local debugging uses the development environment.

The similarities and differences between the environments are as follows:

  1. For the same trigger of an application in different environments, the triggers of production, staging, and development applications will all be executed separately.
  2. However, the trigger of a production application can be either asynchronous or synchronous blocking, while the triggers of staging and development applications must be asynchronous.

7. App Runtime Environment

  1. Production: The production environment, where the app's trigger can be asynchronous or synchronous blocking.
  2. Staging: The pre-release environment, where the app's trigger must be asynchronous.
  3. Development: The development environment, where the app's trigger must be asynchronous.

The development environment is used for local debugging.