Please add a demo that uses this sdk
eladcandroid opened this issue · 6 comments
Not sure how to write it properly...
const Appwrite = require('node-appwrite');
const sdk = new Appwrite();
sdk.setProject('');
sdk.setKey('');
I'm getting: TypeError: Appwrite is not a constructor
Ok, so finally here's my working code (default 80 port):
const Appwrite = require('node-appwrite');
const sdk = new Appwrite.Client();
const db = new Appwrite.Database(sdk);
sdk.setProject('[PROJECT_ID]');
sdk.setKey('[KEY]');
sdk.setEndpoint('http://localhost/v1');
let promise = db.createCollection('CHECK');
promise.then(
function(response) {
console.log(response);
},
function(error) {
console.log(error);
}
);
Hi @eladcandroid , Thank you so much for this valuable feedback! Improving documentation is always high on our list!
We have added some better NodeJS examples to our API reference this weekend, which you can use here: https://appwrite.io/docs
As you might know, this SDK is auto-generated by our SDK generator (learn more here: https://medium.com/appwrite-io/how-we-integrated-our-docs-and-sdks-as-first-class-citizens-of-our-coding-process-8e343def0e9). I will prioritise generating a better README file for all SDKs with some added usage examples.
Ok, so finally here's my working code (default 80 port):
Thanks for sharing @eladcandroid!! I struggled a lot with this SDK a lot and it's nice to see other solutions popping up! I will share mine later this week.
@eldadfux I'd be more than happy to give a hand on better examples in the generator, if you're willing to write some issues (so we know where help is needed)! Otherwise I'll just take a look this weekend and see where I can help
@bogdaaamn that will be great. Improving the documentation is a top priority and any help will be greatly appreciated. You can also join our Gitter community for live support and discussions.
https://gitter.im/appwrite/community
You can contact me directly @ gitter for any question
That's great @eldadfux! I actually got a bunch of question but I found really hard to contact you on twitter. I will message you @ gitter later this weekend.
This is a pretty old one, but if some one has come here still looking for a demo, we have the Appwrite playground for node, which is a very nice way to understand how to use the SDK:
https://github.com/appwrite/playground-for-node
You can also check our getting started guide: https://appwrite.io/docs/getting-started-for-server