From 06edde5cafa96c20409caf8d4b37618b51c257c8 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 10:38:24 +0545 Subject: [PATCH 1/2] node sdk getting started --- docs/sdks/nodejs/GETTING_STARTED.md | 60 +++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/sdks/nodejs/GETTING_STARTED.md diff --git a/docs/sdks/nodejs/GETTING_STARTED.md b/docs/sdks/nodejs/GETTING_STARTED.md new file mode 100644 index 0000000000..b4096157c1 --- /dev/null +++ b/docs/sdks/nodejs/GETTING_STARTED.md @@ -0,0 +1,60 @@ +## Getting Started + +### Init your SDK +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key project API keys section. + +```js +const sdk = require('node-appwrite'); + +let client = new sdk.Client(); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; +``` + +### Make Your First Request +Once your SDK object is set, create any of the Appwrite service project objects 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 section. + +```js +let users = new sdk.Users(client); + +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); +``` + +### Full Example +```js +const sdk = require('node-appwrite'); + +let client = new sdk.Client(); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let users = new sdk.Users(client); +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); +``` + +### Learn more +You can use followng resources to learn more and get help +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Node Playground](https://github.com/appwrite/playground-for-node) From 8547c4e5233543ceb07f50f4bb3067e22dfe56d1 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 18:32:00 +0545 Subject: [PATCH 2/2] fix grammar --- docs/sdks/nodejs/GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdks/nodejs/GETTING_STARTED.md b/docs/sdks/nodejs/GETTING_STARTED.md index b4096157c1..af2564e212 100644 --- a/docs/sdks/nodejs/GETTING_STARTED.md +++ b/docs/sdks/nodejs/GETTING_STARTED.md @@ -16,7 +16,7 @@ client ``` ### Make Your First Request -Once your SDK object is set, create any of the Appwrite service project objects 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 section. +Once your SDK object is set, create any of the Appwrite service objects 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 section. ```js let users = new sdk.Users(client);