File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,17 @@ APP_WRITE_ENDPOINT=https://[YOUR_APPWRITE_ENDPOINT]
1717APP_WRITE_PROJECT_ID=[YOUR_APPWRITE_PROJECT_ID]
1818```
1919
20- Connect the client.
20+ Within you ` webpack.config.js ` you can also ` npm install dotenv --save-dev ` and configure it to load them:
21+
22+ ``` js
23+ require (' dotenv' ).config ();
24+
25+ module .exports = (env ) => {
26+ // rest of config
27+ }
28+ ```
29+
30+ ### Connect Client
2131
2232``` ts
2333import { Client , Account , ID } from ' @nativescript/appwrite' ;
@@ -29,6 +39,39 @@ const client = new Client()
2939const account = new Account (client );
3040```
3141
42+ ### Create Account
43+
44+ ``` ts
45+ const response = await account .create (ID .unique (), ' me@company.com' , ' password' );
46+ console .log (' Account created:' , response );
47+ ```
48+
49+ ### Login
50+
51+ ``` ts
52+ const response = await account .createEmailPasswordSession (' me@company.com' , ' password' );console .log (' Logged in:' , response );
53+ ```
54+
55+ ### List Documents
56+
57+ ``` ts
58+ const database = new Databases (client );
59+ const documents = await database .listDocuments (' database-id' , ' collection-id' );
60+ console .log (' documents:' , documents );
61+ ```
62+
63+ ### Create Documents
64+
65+ ``` ts
66+ const result = await database .createDocument (
67+ ' database-id' ,
68+ ' collection-id' ,
69+ crypto .randomUUID (),
70+ { message: ' Hello World' }
71+ );
72+ console .log (' Document created:' , result );
73+ ```
74+
3275
3376## License
3477
Original file line number Diff line number Diff line change 11{
22 "name" : " @nativescript/appwrite" ,
3- "version" : " 0.0.3 " ,
3+ "version" : " 0.1.1 " ,
44 "description" : " Appwrite SDK for NativeScript" ,
55 "main" : " index" ,
66 "types" : " index.d.ts" ,
You can’t perform that action at this time.
0 commit comments