https://github.com/xinlc/react-native-aliyun-api-gateway
Aliyun API Gateway SDK for react-native
https://github.com/xinlc/react-native-aliyun-api-gateway
api-gateway react-native
Last synced: 3 months ago
JSON representation
Aliyun API Gateway SDK for react-native
- Host: GitHub
- URL: https://github.com/xinlc/react-native-aliyun-api-gateway
- Owner: xinlc
- License: mit
- Created: 2018-01-04T09:31:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-04T09:31:47.000Z (over 7 years ago)
- Last Synced: 2025-01-21T01:11:33.095Z (5 months ago)
- Topics: api-gateway, react-native
- Language: JavaScript
- Homepage:
- Size: 65.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: MIT-License
Awesome Lists containing this project
README
Aliyun API Gateway SDK for react-native
==================================API 网关(API Gateway),提供高性能、高可用的 API 托管服务,帮助用户对外开放其部署在 ECS、容器服务等阿里云产品上的应用,提供完整的 API 发布、管理、维护生命周期管理。用户只需简单操作,即可快速、低成本、低风险的开放数据或服务。
## Installation
You can install it as dependency with npm.
```sh
$ # save into package.json dependencies with -S
$ npm install react-native-aliyun-api-gateway -S
```## Usage
The SDK contains Simple client(authrozied by appcode) and Normal client(authrozied by appid & appsecret).
### Simple client
```js
'use strict';
const co = require('co');
const SimpleClient = require('react-native-aliyun-api-gateway').SimpleClient;
const client = new SimpleClient('YOUR_APP_CODE');co(function* () {
var url = 'http://apiqingdaohttps.foundai.com/test1234';var result = yield client.post(url, {
data: {
'testtest': 'query1Value'
},
headers: {
accept: 'application/json'
}
});console.log(JSON.stringify(result));
});```
### Client (recommend)
```js
'use strict';
const co = require('co');
const Client = require('react-native-aliyun-api-gateway').Client;
const client = new Client('YOUR_APP_KEY','YOUR_APP_SECRET');co(function* () {
var url = 'http://apiqingdaohttps.foundai.com/test1234';var result = yield client.post(url, {
data: {
'testtest': 'query1Value'
},
headers: {
accept: 'application/json'
}
});console.log(JSON.stringify(result));
});
```## Question?
Please submit an issue.
## License
The MIT License