appwrite/docs/examples/0.15.x/server-nodejs/examples/functions/create-deployment.md

21 lines
609 B
Markdown
Raw Normal View History

2022-06-21 08:03:50 +00:00
const sdk = require('node-appwrite');
const fs = require('fs');
// Init SDK
2022-06-23 10:04:54 +00:00
const client = new sdk.Client();
2022-06-21 08:03:50 +00:00
2022-06-23 10:04:54 +00:00
const functions = new sdk.Functions(client);
2022-06-21 08:03:50 +00:00
client
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
2022-08-29 12:09:22 +00:00
const promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile.fromPath('/path/to/file.png', 'file.png'), false);
2022-06-21 08:03:50 +00:00
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});