Created
September 30, 2019 06:38
-
-
Save eldadfux/0591d2205311b02966e5e365fbafad2a to your computer and use it in GitHub Desktop.
Appwrite Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sdk = new Appwrite(); | |
sdk | |
.setEndpoint('YOUR_SERVER_ENDPOINT') // http://localhost/v1 | |
.setProject('YOUR_PROJECT_UID') | |
.setKey('YOUR_API_SECRET') | |
; | |
let promise = sdk.database.createCollection( | |
'Movies', // Collection Name | |
['*'], // Read permissions | |
['user:yyy', 'team:xxx'], // Write permissions | |
[ // Rules | |
{ | |
"label": "Name", | |
"key": "name", | |
"type": "text", | |
"default": "", | |
"required": true, | |
"array": false | |
}, | |
{ | |
"label": "Release Year", | |
"key": "releaseYear", | |
"type": "numeric", | |
"default": 0, | |
"required": true, | |
"array": false | |
}, | |
{ | |
"label": "Notes", | |
"key": "notes", | |
"type": "text", | |
"default": 0, | |
"required": false, | |
"array": true | |
} | |
] | |
); | |
promise.then(function (response) { | |
console.log(response); | |
}, function (error) { | |
console.log(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment