mirror of
https://github.com/appwrite/appwrite
synced 2026-05-21 16:08:22 +00:00
Merge pull request #3413 from appwrite/fix-web-examples
Fix: Web SDK examples
This commit is contained in:
commit
5c1ffdf4a8
1 changed files with 10 additions and 6 deletions
|
|
@ -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