GitXplorerGitXplorer
k

openHarmony-thrift-demo

public
1 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
d30820b945c5f92986a75283d2243afe37caad4c

init

kkonpeki622 committed 3 years ago
Verified
12aab18843154c0a1ba0bb8b4ee58db723801600

Initial commit

kkonpeki622 committed 3 years ago

README

The README file for this repository.

openHarmony-thrift-demo

Demo for thrift applied to OpenHarmonyOS.

Start Server

> cd server
> npm i
> npm run start

The OpenHarmonyOS simulator can not access local host like localhost or 127.0.0.1, so we should do Intranet penetration with tools such as ngrok and use the new address like http://60d3-139-159-170-4.ngrok.io.

Start Client

> cd client/entry
> npm i
# after running 'npm link' in 'thrift' folder
> npm link thrift

Then open the client folder with DevEco Studio, change the host value defined in index.js and config.json to your new address.

// src/main/js/default/pages/index/index.js
const host = 'http://60d3-139-159-170-4.ngrok.io'; //your host address
// src/main/config.js
"default": {
  "network": {
    "cleartextTraffic": true,
    "securityConfig": {
      "domainSettings": {
        "cleartextPermitted": true,
        "domains": [
          {
            "subdomains": true,
            "name": "60d3-139-159-170-4.ngrok.io" //your host address
          }
        ]
      }
    }
  }
}

To Start it, you need to install a phone simulator with API 6. Run it and click the create button, we will get correct data by thrift requesting.