mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-09 04:22:13 +00:00
Add Astro SSR
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
---
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user