Add Astro SSR

This commit is contained in:
Vincent (Wen Yu) Ge
2024-03-10 16:37:06 +01:00
parent 23957475b0
commit 1e0e0cce25
3 changed files with 10 additions and 1 deletions

View File

@@ -75,6 +75,8 @@ function parseCookies(cookies) {
}
```
# Environment variables {% #environment-variables %}
`import.meta.env.APPWRITE_KEY`, `import.meta.env.PUBLIC_APPWRITE_ENDPOINT` and `import.meta.env.PUBLIC_APPWRITE_PROJECT` are environment variables that are exported in your project's [.env file](https://kit.Astro.dev/docs/modules#$env-dynamic-public).
For example, your `.env` might look something similar to this.

View File

@@ -23,7 +23,11 @@ if (user) {
</form>
```
This is an HTML form with an email and password input. When the form is submitted, we want to send the email and password to Appwrite to authenticate the user. To use Astro form actions, add an `if (Astro.request.method === "POST")` statement to the server-side javascript.
This is an HTML form with an email and password input.
When the form is submitted, we want to send the email and password to Appwrite to authenticate the user.
To use Astro form actions, add an `if (Astro.request.method === "POST")` statement to the server-side javascript.
In the same file, implement the following.
```js
---

View File

@@ -4,6 +4,9 @@ title: All set
description: Add authentication to a Astro project using Appwrite.
step: 8
---
Start a preview of your app by running `npm run dev`.
If you want to see the complete source code with styling, see the [demos-for-astro](https://github.com/appwrite/demos-for-astro/tree/main/server-side-rendering) repository.
# Other authentication methods {% #other-authentication-methods %}