Conversation
|
Your Render PR Server URL is https://appwrite-pr-433.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cm11i0md3nmc739v9llg. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Your Render PR Server URL is https://appwrite-io-docker-pr-433.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cmopn2q1hbls739b09h0. |
There was a problem hiding this comment.
The logs background here looks like a bug. I'm pretty sure it should be dark.
There was a problem hiding this comment.
I added it to an issue. It is
| {% cards_item href="/docs/products/functions/execution" title="Execute" %} | ||
| Appwrite Functions can be executed in a variety of ways, like SDK, domains, schedules, events, and more. Learn about executions. | ||
| {% /cards_item %} | ||
| {% cards_item href="/docs/products/functions/execution#domains" title="Domains" %} |
There was a problem hiding this comment.
Oh yeah I broke all these.
| description: Learn what an Appwrite Function can do for you and how to create a new Appwrite Function | ||
| --- | ||
|
|
||
| Each Appwrite Function is a piece of user defined code that can be executed on demand. |
There was a problem hiding this comment.
I wouldnt call it user-defined. either deveoper-defined, or defined by you.
User-defined sounds like end user
| Each Appwrite Function is a piece of user defined code that can be executed on demand. | ||
| When you create a new Appwrite Function, you select a name, ID, and [runtime language](/docs/products/functions/runtimes). | ||
|
|
||
| Each time a function changes, a [deployment](/docs/products/functions/deployments) is created, which is like a version of a function. |
There was a problem hiding this comment.
| Each time a function changes, a [deployment](/docs/products/functions/deployments) is created, which is like a version of a function. | |
| Each time a function's code changes, a [deployment](/docs/products/functions/deployments) is created, which is like a version of a function. |
| {% /tabsitem %} | ||
|
|
||
| {% tabsitem #cli title="CLI" %} | ||
| You can create functions using the CLI, without needing to access the console. |
There was a problem hiding this comment.
| You can create functions using the CLI, without needing to access the console. | |
| You can create functions using the CLI, without needing to access the Console. |
| {% /tabsitem %} | ||
| {% /tabs %} | ||
|
|
||
| After creating your function, create a [deployment](/docs/products/functions/deployments) to add code to the function. |
There was a problem hiding this comment.
In all tabs it also explains how to make first deployment. I don't think we need this sentence
| {% tabsitem #manual title="Manual" %} | ||
| You can also create Appwrite Functions manually by uploading your code in a zipped file. | ||
| In the **Create Function** modal, click **create a function manually** at the bottom to switch to manual create wizard. | ||
| You will asked to upload a zip file with your code. |
There was a problem hiding this comment.
| You will asked to upload a zip file with your code. | |
| You will be asked to upload a zip file with your code. |
| └── index.js | ||
| ``` | ||
|
|
||
| Package your code files into the `.tar.gz` format. **Don't include your dependencies folder**, such as **node_modules**. |
There was a problem hiding this comment.
| Package your code files into the `.tar.gz` format. **Don't include your dependencies folder**, such as **node_modules**. | |
| Package your code files into the `.tar.gz` format. **Don't include your dependencies folder**, such as node_modules. |
Too much boldness, this makes it better
| 1. In the Appwrite Console's sidebar, click **Functions**. | ||
| 2. Click **Create function**. | ||
| 3. Connect your project to a Git repository. Your functions will build and deploy when the repository receives a push. | ||
| 4. If you already have a repository containing an Appwrite Function, connect to it under **Connect Git repository**. |
There was a problem hiding this comment.
| 4. If you already have a repository containing an Appwrite Function, connect to it under **Connect Git repository**. | |
| 4. If you already have a repository containing an Appwrite Function, select it under **Connect Git repository**. |
| This lets you track your code using Git, which makes it easy to integrate Appwrite Functions into your existing code base. | ||
| 1. In the Appwrite Console's sidebar, click **Functions**. | ||
| 2. Click **Create function**. | ||
| 3. Connect your project to a Git repository. Your functions will build and deploy when the repository receives a push. |
There was a problem hiding this comment.
| 3. Connect your project to a Git repository. Your functions will build and deploy when the repository receives a push. | |
| 3. Connect your project to your Git provider. You will be asked to authorize Appwrite and grant access to some resources necessary for the Git deployments to work. |
| When you update a function's runtime, the code of your function may not be compatible with the new runtime. | ||
| Remember to update your code and redeploy your function. |
There was a problem hiding this comment.
| When you update a function's runtime, the code of your function may not be compatible with the new runtime. | |
| Remember to update your code and redeploy your function. | |
| When you update a function's runtime, you may need to update code of your function to make it compatible with the new runtime. |
Above we already have big alert box teiing to redeploy.
There was a problem hiding this comment.
We probably want to add something to the Request section here noting that req.body will contain the object of the event that invoked it, like for buckets.*.files.*.create it'll contain the file that triggered that event
| ## Events {% #events %} | ||
| # Events {% #events %} | ||
|
|
||
| Changes in Appwrite emit events. You can configure Functions to be executed in response to these events. |
There was a problem hiding this comment.
Same thing here for the events section, we should explain that the event trigger can be found in x-appwrite-event header and the body will contain the data of the resource that triggered it
| * `users.*.verification.*.update` | ||
| * | ||
| This event triggers when a verification token for a user is validated. | ||
| Returns [Token Object](/docs/references/cloud/models/token) |
There was a problem hiding this comment.
We need to make sure we have the 1.5 events
| 2. Appwrite passes in request information like headers, body or path through the `context.req` object. | ||
| 3. The runtime executes the code you defined, you can log through the `context.log()` or `context.error()` methods. | ||
| 4. Function terminates when you return results using `return context.res.send()`, `return context.res.json()` or similar. | ||
| 1. The active [deployment](/docs/products/functions/deploy)'s executor will handle the request. |
There was a problem hiding this comment.
These steps are all 1.
There was a problem hiding this comment.
Yes markdown renders them as 1.2.3.4 ;) This in fact works
|
|
||
| # Generated domains {% #generated-domains %} | ||
|
|
||
| 1. In the Appwrite Console's sidebar, click **Functions**. |
There was a problem hiding this comment.
These steps are all 1.
There was a problem hiding this comment.
Yes markdown renders them as 1.2.3.4 ;) This in fact works
| 1. In the Appwrite Console's sidebar, click **Functions**. | ||
| 1. Under the **Domains** tab, you'll find the generated domain from Appwrite and your custom domains. | ||
| 1. Under **Execute access**, set the access to `Any` so that anyone can execute the function. You will use [JWTs](/docs/products/auth/jwt) to authenticate users. | ||
| 1. Under the **Domains** tab, you'll find the generated domain from Appwrite and your custom domains. [Learn about adding a custom domain](/docs/products/functions/domains). |
There was a problem hiding this comment.
These steps all both 1.
There was a problem hiding this comment.
Yes markdown renders them as 1.2.3.4 ;) This in fact works
| --- | ||
| layout: article | ||
| title: Templates | ||
| description: Learn about Appwrite Functions' templates that let you jump start function development to extend your Appwrite APIs. |
There was a problem hiding this comment.
Could the ' in this description cause problems with the parser? I vaguely remember an issue like this, please check it doesn't result in a server error
…/website into feat-functions-refactor

What does this PR do?
Refactor some of function docs, so they're easier to digest
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)