diff --git a/temp/appwrite.json b/temp/appwrite.json deleted file mode 100644 index 643a821415..0000000000 --- a/temp/appwrite.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "projectId": "6374484424b42c83155c", - "projectName": "Default", - "functions": [ - { - "$id": "637449ac7066fa0d8cde", - "name": "My Awesome Function", - "runtime": "node-14.5", - "path": "functions/My Awesome Function", - "entrypoint": "src/index.js", - "ignore": [ - "node_modules", - ".npm" - ], - "execute": [], - "events": [], - "schedule": "", - "timeout": 15 - } - ] -} \ No newline at end of file diff --git a/temp/functions/My Awesome Function/.gitignore b/temp/functions/My Awesome Function/.gitignore deleted file mode 100644 index 2551987d6d..0000000000 --- a/temp/functions/My Awesome Function/.gitignore +++ /dev/null @@ -1,149 +0,0 @@ - -# Created by https://www.toptal.com/developers/gitignore/api/node -# Edit at https://www.toptal.com/developers/gitignore?templates=node - -### Node ### -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional stylelint cache -.stylelintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# vuepress v2.x temp and cache directory -.temp - -# Docusaurus cache and generated files -.docusaurus - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -### Node Patch ### -# Serverless Webpack directories -.webpack/ - -# Optional stylelint cache - -# SvelteKit build / generate output -.svelte-kit - -# End of https://www.toptal.com/developers/gitignore/api/node - -# OS -## Mac -.DS_Store diff --git a/temp/functions/My Awesome Function/README.md b/temp/functions/My Awesome Function/README.md deleted file mode 100644 index 0eb0d2ad04..0000000000 --- a/temp/functions/My Awesome Function/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# My Awesome Function - -Welcome to the documentation of this function 👋 We strongly recommend keeping this file in sync with your function's logic to make sure anyone can easily understand your function in the future. If you don't need documentation, you can remove this file. - -## 🤖 Documentation - -Simple function similar to typical "hello world" example, but instead, we return a simple JSON that tells everyone how awesome developers are. - - - -_Example input:_ - -This function expects no input - - - -_Example output:_ - - - -```json -{ - "areDevelopersAwesome": true -} -``` - -## 📝 Environment Variables - -List of environment variables used by this cloud function: - -- **APPWRITE_FUNCTION_ENDPOINT** - Endpoint of Appwrite project -- **APPWRITE_FUNCTION_API_KEY** - Appwrite API Key - - -## 🚀 Deployment - -There are two ways of deploying the Appwrite function, both having the same results, but each using a different process. We highly recommend using CLI deployment to achieve the best experience. - -### Using CLI - -Make sure you have [Appwrite CLI](https://appwrite.io/docs/command-line#installation) installed, and you have successfully logged into your Appwrite server. To make sure Appwrite CLI is ready, you can use the command `appwrite client --debug` and it should respond with green text `✓ Success`. - -Make sure you are in the same folder as your `appwrite.json` file and run `appwrite deploy function` to deploy your function. You will be prompted to select which functions you want to deploy. - -### Manual using tar.gz - -Manual deployment has no requirements and uses Appwrite Console to deploy the tag. First, enter the folder of your function. Then, create a tarball of the whole folder and gzip it. After creating `.tar.gz` file, visit Appwrite Console, click on the `Deploy Tag` button and switch to the `Manual` tab. There, set the `entrypoint` to `src/index.js`, and upload the file we just generated. diff --git a/temp/functions/My Awesome Function/package.json b/temp/functions/My Awesome Function/package.json deleted file mode 100644 index fa252199b9..0000000000 --- a/temp/functions/My Awesome Function/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "appwrite-function", - "version": "1.0.0", - "description": "", - "main": "src/index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "node-appwrite": "^8.0.0" - } -} diff --git a/temp/functions/My Awesome Function/src/index.js b/temp/functions/My Awesome Function/src/index.js deleted file mode 100644 index 4ed0028cac..0000000000 --- a/temp/functions/My Awesome Function/src/index.js +++ /dev/null @@ -1,46 +0,0 @@ -const sdk = require("node-appwrite"); - -/* - 'req' variable has: - 'headers' - object with request headers - 'payload' - request body data as a string - 'variables' - object with function variables - - 'res' variable has: - 'send(text, status)' - function to return text response. Status code defaults to 200 - 'json(obj, status)' - function to return JSON response. Status code defaults to 200 - - If an error is thrown, a response with code 500 will be returned. -*/ - -module.exports = async function (req, res) { - const client = new sdk.Client(); - - // You can remove services you don't use - const account = new sdk.Account(client); - const avatars = new sdk.Avatars(client); - const database = new sdk.Databases(client); - const functions = new sdk.Functions(client); - const health = new sdk.Health(client); - const locale = new sdk.Locale(client); - const storage = new sdk.Storage(client); - const teams = new sdk.Teams(client); - const users = new sdk.Users(client); - - if ( - !req.variables['APPWRITE_FUNCTION_ENDPOINT'] || - !req.variables['APPWRITE_FUNCTION_API_KEY'] - ) { - console.warn("Environment variables are not set. Function cannot use Appwrite SDK."); - } else { - client - .setEndpoint(req.variables['APPWRITE_FUNCTION_ENDPOINT']) - .setProject(req.variables['APPWRITE_FUNCTION_PROJECT_ID']) - .setKey(req.variables['APPWRITE_FUNCTION_API_KEY']) - .setSelfSigned(true); - } - - res.json({ - areDevelopersAwesome: true, - }); -};