Update web SDK example
This commit is contained in:
parent
a7a6afeb7b
commit
6d91d57d56
|
@ -10,9 +10,9 @@ Initialize your SDK with your Appwrite server API endpoint and project ID which
|
|||
|
||||
```js
|
||||
// Init your Web SDK
|
||||
const sdk = new Appwrite();
|
||||
const client = new Client();
|
||||
|
||||
sdk
|
||||
client
|
||||
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
|
||||
.setProject('455x34dfkj') // Your project ID
|
||||
;
|
||||
|
@ -22,8 +22,10 @@ sdk
|
|||
Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
|
||||
|
||||
```js
|
||||
const account = new Account(client);
|
||||
|
||||
// Register User
|
||||
sdk.account.create('[USER_ID]', 'me@example.com', 'password', 'Jane Doe')
|
||||
account.create('[USER_ID]', 'me@example.com', 'password', 'Jane Doe')
|
||||
.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
|
@ -35,15 +37,17 @@ sdk.account.create('[USER_ID]', 'me@example.com', 'password', 'Jane Doe')
|
|||
### Full Example
|
||||
```js
|
||||
// Init your Web SDK
|
||||
const sdk = new Appwrite();
|
||||
const client = new Client();
|
||||
|
||||
sdk
|
||||
client
|
||||
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
|
||||
.setProject('455x34dfkj')
|
||||
;
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
// Register User
|
||||
sdk.account.create('[USER_ID]', 'me@example.com', 'password', 'Jane Doe')
|
||||
account.create('[USER_ID]', 'me@example.com', 'password', 'Jane Doe')
|
||||
.then(function (response) {
|
||||
console.log(response);
|
||||
}, function (error) {
|
||||
|
|
Loading…
Reference in a new issue