Merge pull request #3413 from appwrite/fix-web-examples

Fix: Web SDK examples
This commit is contained in:
Torsten Dittmann 2022-06-22 10:08:04 +02:00 committed by GitHub
commit 5c1ffdf4a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {