Merge branch 'main' of https://github.com/appwrite/website into test-rolldown

This commit is contained in:
Torsten Dittmann
2025-06-11 17:14:43 +02:00
28 changed files with 536 additions and 548 deletions

View File

@@ -1,4 +1,4 @@
FROM node:22-bullseye as base
FROM node:22-bullseye AS base
ARG PUBLIC_APPWRITE_ENDPOINT
ENV PUBLIC_APPWRITE_ENDPOINT ${PUBLIC_APPWRITE_ENDPOINT}
@@ -60,13 +60,13 @@ COPY pnpm-lock.yaml pnpm-lock.yaml
RUN npm i -g corepack@latest
RUN corepack enable
FROM base as build
FROM base AS build
COPY . .
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN NODE_OPTIONS=--max_old_space_size=16384 ROLLDOWN_OPTIONS_VALIDATION=loose pnpm run build
FROM base as final
FROM base AS final
# Install fontconfig
COPY ./local-fonts /usr/share/fonts

View File

@@ -117,6 +117,7 @@
},
"onlyBuiltDependencies": [
"@parcel/watcher",
"@tailwindcss/oxide",
"core-js",
"esbuild",
"rolldown",

View File

@@ -136,29 +136,16 @@
flex-basis: 5rem !important;
}
.web-strip-plans-item-wrapper {
gap: 2.65rem;
}
@media (min-width: 1024px) and (max-width: 1224px) {
.web-strip-plans-info {
flex-basis: 1rem !important;
}
.web-strip-plans-item-wrapper {
gap: 1.25rem !important;
inline-size: 100% !important;
}
}
@media (max-width: 1024px) {
.web-strip-plans-info {
flex-basis: 3rem !important;
}
.web-strip-plans-item-wrapper {
gap: 1.25rem !important;
}
}
.web-pre-footer-bg {

View File

@@ -98,12 +98,12 @@
on:emblaInit={onEmblaInit}
>
<div class="embla__container flex">
{#each events as _}
{#each events as { poster, title }}
<div
class="embla__slide bg-card/90 mr-4 min-w-0 [flex:0_0_33%] items-center rounded-lg p-4"
>
<img src={_.poster} class="m-auto rounded-t" />
<h3 class="mt-0.5 text-base font-medium">{_.title}</h3>
<img alt={title} src={poster} class="m-auto rounded-t" />
<h3 class="mt-0.5 text-base font-medium">{title}</h3>
</div>
{/each}
</div>

View File

@@ -1,9 +1,8 @@
import { APPWRITE_DB_INIT_ID, APPWRITE_COL_INIT_ID } from '$env/static/private';
import { DOMParser, parseHTML } from 'linkedom';
import type { TicketData } from './tickets';
import { APPWRITE_COL_INIT_ID, APPWRITE_DB_INIT_ID } from '$env/static/private';
import { parseHTML } from 'linkedom';
import { z } from 'zod';
import { createInitServerClient } from './appwrite';
import type { TicketData } from './tickets';
const contributionsSchema = z.array(z.array(z.number()));
export type ContributionsMatrix = z.infer<typeof contributionsSchema>;

View File

@@ -1,8 +1,5 @@
import { redirect, type Action, type Actions } from '@sveltejs/kit';
import { redirect, type Actions } from '@sveltejs/kit';
import { getTicketByUser } from './(utils)/tickets';
import { OAuthProvider } from 'appwrite';
import { Account, Client } from 'node-appwrite';
import { PUBLIC_APPWRITE_ENDPOINT, PUBLIC_APPWRITE_PROJECT_INIT_ID } from '$env/static/public';
import { loginGithub } from './(utils)/auth';
export const prerender = false;

View File

@@ -1,9 +1,6 @@
import { getTicketDocByUsername } from '../../(utils)/tickets';
import { error, redirect, type Actions } from '@sveltejs/kit';
import { getTicketContributions } from '../../(utils)/contributions';
import { OAuthProvider } from 'appwrite';
import { Account, Client } from 'node-appwrite';
import { PUBLIC_APPWRITE_ENDPOINT, PUBLIC_APPWRITE_PROJECT_INIT_ID } from '$env/static/public';
import { loginGithub } from '../../(utils)/auth';
export const ssr = true;

View File

@@ -0,0 +1,15 @@
import { Client, Account } from 'node-appwrite';
async function getLoggedInUser(context) {
const session = cookies().get('custom-session-cookie');
if (!session) return;
const client = new Client()
.setEndpoint(import.meta.env.PUBLIC_APPWRITE_ENDPOINT)
.setProject(import.meta.env.PUBLIC_APPWRITE_PROJECT_ID);
client.setSession(session.value);
const account = new Account(client);
return account.get();
}

View File

@@ -0,0 +1,16 @@
import { Client, Account } from 'node-appwrite';
import { cookies } from 'next/headers';
async function getLoggedInUser() {
const session = cookies().get('custom-session-cookie');
if (!session) return;
const client = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID);
client.setSession(session.value);
const account = new Account(client);
return account.get();
}

View File

@@ -0,0 +1,16 @@
import { Client, Account } from 'node-appwrite';
import { H3Event, getCookie } from 'h3';
async function getLoggedInUser(event) {
const session = getCookie(event, 'custom-session-cookie');
if (!session) return;
const client = new Client()
.setEndpoint(process.env.PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.PUBLIC_APPWRITE_PROJECT_ID);
client.setSession(session.value);
const account = new Account(client);
return account.get();
}

View File

@@ -0,0 +1,21 @@
import { Client, Account } from 'node-appwrite';
import { createCookie } from '@remix-run/node';
export const customSessionCookie = createCookie('custom-session-cookie', {
maxAge: 604800,
});
async function getLoggedInUser(request) {
const cookies = request.headers.get('Cookie');
const session = await customSessionCookie.parse(cookies):
if (!session) return;
const client = new Client()
.setEndpoint(process.env.PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.PUBLIC_APPWRITE_PROJECT_ID);
client.setSession(session.value);
const account = new Account(client);
return await account.get();
}

View File

@@ -0,0 +1,15 @@
import { Client, Account } from 'node-appwrite';
async function getLoggedInUser() {
const session = cookies().get('custom-session-cookie');
if (!session) return;
const client = new Client()
.setEndpoint(process.env.PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.PUBLIC_APPWRITE_PROJECT_ID);
client.setSession(session.value);
const account = new Account(client);
return account.get();
}

View File

@@ -1,117 +1,40 @@
<script lang="ts">
import { PUBLIC_APPWRITE_DASHBOARD } from '$env/static/public';
import { trackEvent } from '$lib/actions/analytics';
import { Tooltip } from '$lib/components';
import { Button } from '$lib/components/ui';
import { Framework, Platform } from '$lib/utils/references';
import MultiFrameworkCode from './MultiFrameworkCode.svelte';
import SnippetNextJs from './(snippets)/nextjs.txt';
import SnippetSvelteKit from './(snippets)/sveltekit.txt';
import SnippetAstro from './(snippets)/astro.txt';
import SnippetNuxt from './(snippets)/nuxt.txt';
import SnippetRemix from './(snippets)/remix.txt';
const codeSnippets = [
{
language: Platform.ClientWeb,
platform: Framework.NextJs,
content: `import { Client, Account } from 'node-appwrite'
import { cookies } from 'next/headers'
async function getLoggedInUser() {
const session = cookies().get("custom-session-cookie");
if (!session) return
const client = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID)
client.setSession(session.value)
const account = new Account(client);
return await account.get()
}
`
content: SnippetNextJs
},
{
language: Platform.ClientWeb,
platform: Framework.SvelteKit,
content: `import { Client, Account } from 'node-appwrite'
async function getLoggedInUser() {
const session = cookies().get("custom-session-cookie");
if (!session) return
const client = new Client()
.setEndpoint(process.env.PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.PUBLIC_APPWRITE_PROJECT_ID)
client.setSession(session.value)
const account = new Account(client);
return await account.get()
}
`
content: SnippetSvelteKit
},
{
language: Platform.ClientWeb,
platform: Framework.Astro,
content: `import { Client, Account } from 'node-appwrite'
async function getLoggedInUser(context) {
const session = cookies().get("custom-session-cookie");
if (!session) return
const client = new Client()
.setEndpoint(import.meta.env.PUBLIC_APPWRITE_ENDPOINT)
.setProject(import.meta.env.PUBLIC_APPWRITE_PROJECT_ID)
client.setSession(session.value)
const account = new Account(client);
return await account.get()
}
`
content: SnippetAstro
},
{
language: Platform.ClientWeb,
platform: Framework.Nuxt3,
content: `import { Client, Account } from 'node-appwrite'
import { H3Event, getCookie } from 'h3'
async function getLoggedInUser(event) {
const session = getCookie(event, "custom-session-cookie");
if (!session) return
const client = new Client()
.setEndpoint(process.env.PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.PUBLIC_APPWRITE_PROJECT_ID)
client.setSession(session.value)
const account = new Account(client);
return await account.get()
}`
content: SnippetNuxt
},
{
language: Platform.ClientWeb,
platform: Framework.Remix,
content: `import { Client, Account } from 'node-appwrite'
import { createCookie } from '@remix-run/node'
export const customSessionCookie = createCookie("custom-session-cookie", {
maxAge: 604800,
})
async function getLoggedInUser(request) {
const cookies = request.headers.get("Cookie")
const session = await customSessionCookie.parse(cookies)
if (!session) return
const client = new Client()
.setEndpoint(process.env.PUBLIC_APPWRITE_ENDPOINT)
.setProject(process.env.PUBLIC_APPWRITE_PROJECT_ID)
client.setSession(session.value)
const account = new Account(client);
return await account.get()
}`
content: SnippetRemix
}
];

View File

@@ -0,0 +1,42 @@
namespace DotNetRuntime;
using Appwrite;
using Appwrite.Services;
using Appwrite.Models;
public class Handler {
// This is your Appwrite function
// It"s executed each time we get a request
public async Task Main(RuntimeContext Context)
{
// Why not try the Appwrite SDK?
//
// Set project and set API key
// var client = new Client()
// .SetProject(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_PROJECT_ID"))
// .SetKey(Context.Req.Headers["x-appwrite-key"]);
// You can log messages to the console
Context.Log("Hello, Logs!");
// If something goes wrong, log an error
Context.Error("Hello, Errors!");
// The 'Context.Req' object contains the request data
if (Context.Req.Method == "GET") {
// Send a response with the res object helpers
// 'Context.Res.Text()' dispatches a string back to the client
return Context.Res.Text("Hello, World!");
}
// 'Context.Res.Json()' is a handy helper for sending JSON
return Context.Res.Json(new Dictionary()
{
{ "motto", "Build like a team of hundreds_" },
{ "learn", "https://appwrite.io/docs" },
{ "connect", "https://appwrite.io/discord" },
{ "getInspired", "https://builtwith.appwrite.io" },
});
}
}

View File

@@ -0,0 +1,35 @@
import 'dart:async';
import 'package:dart_appwrite/dart_appwrite.dart';
// This is your Appwrite function
// It's executed each time we get a request
Future main(final context) async {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// final client = Client()
// .setProject(Platform.environment['APPWRITE_FUNCTION_PROJECT_ID'])
// .setKey(context.req.headers['x-appwrite-key']);
// You can log messages to the console
context.log('Hello, Logs!');
// If something goes wrong, log an error
context.error('Hello, Errors!');
// The 'req' object contains the request data
if (context.req.method == 'GET') {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return context.res.text('Hello, World!');
}
// 'res.json()' is a handy helper for sending JSON
return context.res.json({
'motto': 'Build like a team of hundreds_',
'learn': 'https://appwrite.io/docs',
'connect': 'https://appwrite.io/discord',
'getInspired': 'https://builtwith.appwrite.io',
});
}

View File

@@ -0,0 +1,33 @@
import { Client } from "https://deno.land/x/appwrite@7.0.0/mod.ts";
// This is your Appwrite function
// It's executed each time we get a request
export default ({ req, res, log, error }: any) => {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// const client = new Client()
// .setProject(Deno.env.get("APPWRITE_FUNCTION_PROJECT_ID") || "")
// .setKey(req.headers["x-appwrite-key"] || "");
// You can log messages to the console
log("Hello, Logs!");
// If something goes wrong, log an error
error("Hello, Errors!");
// The 'req' object contains the request data
if (req.method === "GET") {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return res.text("Hello, World!");
}
// 'res.json()' is a handy helper for sending JSON
return res.json({
motto: "Build like a team of hundreds_",
learn: "https://appwrite.io/docs",
connect: "https://appwrite.io/discord",
getInspired: "https://builtwith.appwrite.io",
});
};

View File

@@ -0,0 +1,45 @@
package handler
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go/appwrite"
"github.com/open-runtimes/types-for-go/v4/openruntimes"
)
type Response struct {
Motto string `json:"motto"`
Learn string `json:"learn"`
Connect string `json:"connect"`
GetInspired string `json:"getInspired"`
}
func Main(Context openruntimes.Context) openruntimes.Response {
// This is your Appwrite function
// It's executed each time we get a request service
var _ = appwrite.NewClient(
appwrite.WithProject(os.Getenv("APPWRITE_FUNCTION_PROJECT_ID")),
appwrite.WithKey(Context.Req.Headers["x-appwrite-key"]),
)
// You can log messages to the console
fmt.Println("Hello, Logs!")
fmt.Fprintln(os.Stderr, "Error:", "Hello, Errors!")
// The 'Context.Req' object contains the request data
if Context.Req.Method == "GET" {
// Send a response with the Context.Res object helpers
// 'Context.Res.Text()' dispatches a string back to the client
return Context.Res.Text("Hello, World!")
}
// 'res.json()' is a handy helper for sending JSON
return Context.Res.Json(
Response{
Motto: "Build like a team of hundreds_",
Learn: "https://appwrite.io/docs",
Connect: "https://appwrite.io/discord",
GetInspired: "https://builtwith.appwrite.io",
})
}

View File

@@ -0,0 +1,42 @@
package io.openruntimes.java.src;
import io.openruntimes.java.RuntimeContext;
import io.openruntimes.java.RuntimeOutput;
import java.util.HashMap;
import io.appwrite.Client;
public class Main {
// This is your Appwrite function
// It's executed each time we get a request
public RuntimeOutput main(RuntimeContext context) throws Exception {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// Client client = new Client();
// .setProject(System.getenv("APPWRITE_FUNCTION_PROJECT_ID"))
// .setKey(context.getReq().getHeaders().get("x-appwrite-key"));
// You can log messages to the console
context.log("Hello, Logs!");
// If something goes wrong, log an error
context.error("Hello, Errors!");
// The 'context.getReq()' object contains the request data
if (context.getReq().getMethod().equals("GET")) {
// Send a response with the res object helpers
// 'context.getRes().text()' dispatches a string back to the client
return context.getRes().text("Hello, World!");
}
Map json = new HashMap<>();
json.put("motto", "Build like a team of hundreds_");
json.put("learn", "https://appwrite.io/docs");
json.put("connect", "https://appwrite.io/discord");
json.put("getInspired", "https://builtwith.appwrite.io");
// 'context.getRes().json()' is a handy helper for sending JSON
return context.getRes().json(json);
}
}

View File

@@ -0,0 +1,40 @@
package io.openruntimes.kotlin.src
import io.openruntimes.kotlin.RuntimeContext
import io.openruntimes.kotlin.RuntimeOutput
import io.appwrite.Client
import java.util.HashMap
class Main {
// This is your Appwrite function
// It's executed each time we get a request
fun main(context: RuntimeContext): RuntimeOutput {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// val client = Client()
// .setProject(System.getenv("APPWRITE_FUNCTION_PROJECT_ID"))
// .setKey(context.req.headers["x-appwrite-key"])
// You can log messages to the console
context.log("Hello, Logs!")
// If something goes wrong, log an error
context.error("Hello, Errors!")
// The 'context.req' object contains the request data
if (context.req.method == "GET") {
// Send a response with the res object helpers
// 'context.res.text()' dispatches a string back to the client
return context.res.text("Hello, World!")
}
// 'context.res.json()' is a handy helper for sending JSON
return context.res.json(mutableMapOf(
"motto" to "Build like a team of hundreds_",
"learn" to "https://appwrite.io/docs",
"connect" to "https://appwrite.io/discord",
"getInspired" to "https://builtwith.appwrite.io"
))
}
}

View File

@@ -0,0 +1,33 @@
import { Client } from 'node-appwrite';
// This is your Appwrite function
// It's executed each time we get a request
export default async ({ req, res, log, error }) => {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// const client = new Client()
// .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
// .setKey(req.headers['x-appwrite-key']);
// You can log messages to the console
log('Hello, Logs!');
// If something goes wrong, log an error
error('Hello, Errors!');
// The 'req' object contains the request data
if (req.method === 'GET') {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return res.text('Hello, World!');
}
// 'res.json()' is a handy helper for sending JSON
return res.json({
motto: 'Build like a team of hundreds_',
learn: 'https://appwrite.io/docs',
connect: 'https://appwrite.io/discord',
getInspired: 'https://builtwith.appwrite.io',
});
};

View File

@@ -0,0 +1,36 @@
require(__DIR__ . '/../vendor/autoload.php');
use Appwrite\Client;
use Appwrite\Exception;
// This is your Appwrite function
// It's executed each time we get a request
return function ($context) {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// $client = (new Client())
// ->setProject(getenv(APPWRITE_FUNCTION_PROJECT_ID))
// ->setKey($context->req->headers['x-appwrite-key']);
// You can log messages to the console
$context->log('Hello, Logs!');
// If something goes wrong, log an error
$context->error('Hello, Errors!');
// The 'req' object contains the request data
if ($context->req->method === 'GET') {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return $context->res->text('Hello, World!');
}
// 'res.json()' is a handy helper for sending JSON
return $context->res->json([
'motto' => 'Build like a team of hundreds_',
'learn' => 'https://appwrite.io/docs',
'connect' => 'https://appwrite.io/discord',
'getInspired' => 'https://builtwith.appwrite.io',
]);
};

View File

@@ -0,0 +1,34 @@
from appwrite.client import Client
import os
# This is your Appwrite function
# It's executed each time we get a request
def main(context):
# Why not try the Appwrite SDK?
#
# Set project and set API key
# client = (
# Client()
# .set_project(os.environ["APPWRITE_FUNCTION_PROJECT_ID"])
# .set_key(context.req.headers["x-appwrite-key"])
# )
# You can log messages to the console
context.log("Hello, Logs!")
# If something goes wrong, log an error
context.error("Hello, Errors!")
# The 'context.req' object contains the request data
if context.req.method == "GET":
# Send a response with the res object helpers
# 'context.res.text()' dispatches a string back to the client
return context.res.text("Hello, World!")
# 'context.res.json()' is a handy helper for sending JSON
return context.res.json({
"motto": "Build like a team of hundreds_",
"learn": "https://appwrite.io/docs",
"connect": "https://appwrite.io/discord",
"getInspired": "https://builtwith.appwrite.io",
})

View File

@@ -0,0 +1,33 @@
require "appwrite"
# This is your Appwrite function
# It's executed each time we get a request
def main(context)
# Why not try the Appwrite SDK?
#
# Set project and set API key
# client = Client.new
# .set_project(ENV['APPWRITE_FUNCTION_PROJECT_ID'])
# .set_key(context.req.headers['x-appwrite-key'])
# You can log messages to the console
context.log("Hello, Logs!")
# If something goes wrong, log an error
context.error("Hello, Errors!")
# The 'context.req' object contains the request data
if (context.req.method == "GET")
# Send a response with the res object helpers
# 'context.res.text()' dispatches a string back to the client
return context.res.text("Hello, World!")
end
# 'context.res.json()' is a handy helper for sending JSON
return context.res.json({
"motto": "Build like a team of hundreds_",
"learn": "https://appwrite.io/docs",
"connect": "https://appwrite.io/discord",
"getInspired": "https://builtwith.appwrite.io",
})
end

View File

@@ -0,0 +1,35 @@
import Appwrite
import AppwriteModels
import Foundation
// This is your Appwrite function
// It's executed each time we get a request
func main(context: RuntimeContext) async throws -> RuntimeOutput {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// let client = Client()
// .setProject(ProcessInfo.processInfo.environment["APPWRITE_FUNCTION_PROJECT_ID"])
// .setKey(context.req.headers["x-appwrite-key"] ?? "")
// You can log messages to the console
context.log("Hello, Logs!")
// If something goes wrong, log an error
context.error("Hello, Errors!")
// The 'context.req' object contains the request data
if context.req.method == "GET" {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return context.res.text("Hello, World!")
}
// 'context.res.json()' is a handy helper for sending JSON
return try context.res.json([
"motto": "Build like a team of hundreds_",
"learn": "https://appwrite.io/docs",
"connect": "https://appwrite.io/discord",
"getInspired": "https://builtwith.appwrite.io",
])
}

View File

@@ -2,463 +2,65 @@
import { Button } from '$lib/components/ui';
import { Platform } from '$lib/utils/references';
import MultiCodeContextless from '$routes/products/messaging/(components)/MultiCodeContextless.svelte';
import SnippetNodejs from './(snippets)/nodejs.txt';
import SnippetPhp from './(snippets)/php.txt';
import SnippetPython from './(snippets)/python.txt';
import SnippetRuby from './(snippets)/ruby.txt';
import SnippetDeno from './(snippets)/deno.txt';
import SnippetGo from './(snippets)/go.txt';
import SnippetDart from './(snippets)/dart.txt';
import SnippetKotlin from './(snippets)/kotlin.txt';
import SnippetJava from './(snippets)/java.txt';
import SnippetSwift from './(snippets)/swift.txt';
import SnippetCsharp from './(snippets)/csharp.txt';
const codeTopic = [
{
language: 'server-nodejs',
platform: 'Web',
content: `import { Client } from 'node-appwrite';
// This is your Appwrite function
// It's executed each time we get a request
export default async ({ req, res, log, error }) => {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// const client = new Client()
// .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
// .setKey(req.headers['x-appwrite-key']);
// You can log messages to the console
log('Hello, Logs!');
// If something goes wrong, log an error
error('Hello, Errors!');
// The 'req' object contains the request data
if (req.method === 'GET') {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return res.text('Hello, World!');
}
// 'res.json()' is a handy helper for sending JSON
return res.json({
motto: 'Build like a team of hundreds_',
learn: 'https://appwrite.io/docs',
connect: 'https://appwrite.io/discord',
getInspired: 'https://builtwith.appwrite.io',
});
};
`
content: SnippetNodejs
},
{
language: 'php',
platform: 'PHP',
content: `require(__DIR__ . '/../vendor/autoload.php');
use Appwrite\Client;
use Appwrite\Exception;
// This is your Appwrite function
// It's executed each time we get a request
return function ($context) {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// $client = (new Client())
// ->setProject(getenv(APPWRITE_FUNCTION_PROJECT_ID))
// ->setKey($context->req->headers['x-appwrite-key']);
// You can log messages to the console
$context->log('Hello, Logs!');
// If something goes wrong, log an error
$context->error('Hello, Errors!');
// The 'req' object contains the request data
if ($context->req->method === 'GET') {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return $context->res->text('Hello, World!');
}
// 'res.json()' is a handy helper for sending JSON
return $context->res->json([
'motto' => 'Build like a team of hundreds_',
'learn' => 'https://appwrite.io/docs',
'connect' => 'https://appwrite.io/discord',
'getInspired' => 'https://builtwith.appwrite.io',
]);
};
`
content: SnippetPhp
},
{
language: 'python',
platform: 'Python',
content: `from appwrite.client import Client
import os
# This is your Appwrite function
# It's executed each time we get a request
def main(context):
# Why not try the Appwrite SDK?
#
# Set project and set API key
# client = (
# Client()
# .set_project(os.environ["APPWRITE_FUNCTION_PROJECT_ID"])
# .set_key(context.req.headers["x-appwrite-key"])
# )
# You can log messages to the console
context.log("Hello, Logs!")
# If something goes wrong, log an error
context.error("Hello, Errors!")
# The 'context.req' object contains the request data
if context.req.method == "GET":
# Send a response with the res object helpers
# 'context.res.text()' dispatches a string back to the client
return context.res.text("Hello, World!")
# 'context.res.json()' is a handy helper for sending JSON
return context.res.json({
"motto": "Build like a team of hundreds_",
"learn": "https://appwrite.io/docs",
"connect": "https://appwrite.io/discord",
"getInspired": "https://builtwith.appwrite.io",
})
`
content: SnippetPython
},
{
language: 'ruby',
content: `require "appwrite"
# This is your Appwrite function
# It's executed each time we get a request
def main(context)
# Why not try the Appwrite SDK?
#
# Set project and set API key
# client = Client.new
# .set_project(ENV['APPWRITE_FUNCTION_PROJECT_ID'])
# .set_key(context.req.headers['x-appwrite-key'])
# You can log messages to the console
context.log("Hello, Logs!")
# If something goes wrong, log an error
context.error("Hello, Errors!")
# The 'context.req' object contains the request data
if (context.req.method == "GET")
# Send a response with the res object helpers
# 'context.res.text()' dispatches a string back to the client
return context.res.text("Hello, World!")
end
# 'context.res.json()' is a handy helper for sending JSON
return context.res.json({
"motto": "Build like a team of hundreds_",
"learn": "https://appwrite.io/docs",
"connect": "https://appwrite.io/discord",
"getInspired": "https://builtwith.appwrite.io",
})
end
`
content: SnippetRuby
},
{
language: 'deno',
content: `import { Client } from "https://deno.land/x/appwrite@7.0.0/mod.ts";
// This is your Appwrite function
// It's executed each time we get a request
export default ({ req, res, log, error }: any) => {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// const client = new Client()
// .setProject(Deno.env.get("APPWRITE_FUNCTION_PROJECT_ID") || "")
// .setKey(req.headers["x-appwrite-key"] || "");
// You can log messages to the console
log("Hello, Logs!");
// If something goes wrong, log an error
error("Hello, Errors!");
// The 'req' object contains the request data
if (req.method === "GET") {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return res.text("Hello, World!");
}
// 'res.json()' is a handy helper for sending JSON
return res.json({
motto: "Build like a team of hundreds_",
learn: "https://appwrite.io/docs",
connect: "https://appwrite.io/discord",
getInspired: "https://builtwith.appwrite.io",
});
};
`
content: SnippetDeno
},
{
language: 'go',
content: `package handler
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go/appwrite"
"github.com/open-runtimes/types-for-go/v4/openruntimes"
)
type Response struct {
Motto string 'json:"motto"'
Learn string 'json:"learn"'
Connect string 'json:"connect"'
GetInspired string 'json:"getInspired"'
}
func Main(Context openruntimes.Context) openruntimes.Response {
// This is your Appwrite function
// It's executed each time we get a request service
var _ = appwrite.NewClient(
appwrite.WithProject(os.Getenv("APPWRITE_FUNCTION_PROJECT_ID")),
appwrite.WithKey(Context.Req.Headers["x-appwrite-key"]),
)
// You can log messages to the console
fmt.Println("Hello, Logs!")
fmt.Fprintln(os.Stderr, "Error:", "Hello, Errors!")
// The 'Context.Req' object contains the request data
if Context.Req.Method == "GET" {
// Send a response with the Context.Res object helpers
// 'Context.Res.Text()' dispatches a string back to the client
return Context.Res.Text("Hello, World!")
}
// 'res.json()' is a handy helper for sending JSON
return Context.Res.Json(
Response{
Motto: "Build like a team of hundreds_",
Learn: "https://appwrite.io/docs",
Connect: "https://appwrite.io/discord",
GetInspired: "https://builtwith.appwrite.io",
})
}
`
content: SnippetGo
},
{
language: 'dart',
content: `import 'dart:async';
import 'package:dart_appwrite/dart_appwrite.dart';
// This is your Appwrite function
// It's executed each time we get a request
Future main(final context) async {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// final client = Client()
// .setProject(Platform.environment['APPWRITE_FUNCTION_PROJECT_ID'])
// .setKey(context.req.headers['x-appwrite-key']);
// You can log messages to the console
context.log('Hello, Logs!');
// If something goes wrong, log an error
context.error('Hello, Errors!');
// The 'req' object contains the request data
if (context.req.method == 'GET') {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return context.res.text('Hello, World!');
}
// 'res.json()' is a handy helper for sending JSON
return context.res.json({
'motto': 'Build like a team of hundreds_',
'learn': 'https://appwrite.io/docs',
'connect': 'https://appwrite.io/discord',
'getInspired': 'https://builtwith.appwrite.io',
});
}
`
content: SnippetDart
},
{
language: 'kotlin',
content: `package io.openruntimes.kotlin.src
import io.openruntimes.kotlin.RuntimeContext
import io.openruntimes.kotlin.RuntimeOutput
import io.appwrite.Client
import java.util.HashMap
class Main {
// This is your Appwrite function
// It's executed each time we get a request
fun main(context: RuntimeContext): RuntimeOutput {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// val client = Client()
// .setProject(System.getenv("APPWRITE_FUNCTION_PROJECT_ID"))
// .setKey(context.req.headers["x-appwrite-key"])
// You can log messages to the console
context.log("Hello, Logs!")
// If something goes wrong, log an error
context.error("Hello, Errors!")
// The 'context.req' object contains the request data
if (context.req.method == "GET") {
// Send a response with the res object helpers
// 'context.res.text()' dispatches a string back to the client
return context.res.text("Hello, World!")
}
// 'context.res.json()' is a handy helper for sending JSON
return context.res.json(mutableMapOf(
"motto" to "Build like a team of hundreds_",
"learn" to "https://appwrite.io/docs",
"connect" to "https://appwrite.io/discord",
"getInspired" to "https://builtwith.appwrite.io"
))
}
}
`
content: SnippetKotlin
},
{
language: 'java',
content: `package io.openruntimes.java.src;
import io.openruntimes.java.RuntimeContext;
import io.openruntimes.java.RuntimeOutput;
import java.util.HashMap;
import io.appwrite.Client;
public class Main {
// This is your Appwrite function
// It's executed each time we get a request
public RuntimeOutput main(RuntimeContext context) throws Exception {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// Client client = new Client();
// .setProject(System.getenv("APPWRITE_FUNCTION_PROJECT_ID"))
// .setKey(context.getReq().getHeaders().get("x-appwrite-key"));
// You can log messages to the console
context.log("Hello, Logs!");
// If something goes wrong, log an error
context.error("Hello, Errors!");
// The 'context.getReq()' object contains the request data
if (context.getReq().getMethod().equals("GET")) {
// Send a response with the res object helpers
// 'context.getRes().text()' dispatches a string back to the client
return context.getRes().text("Hello, World!");
}
Map json = new HashMap<>();
json.put("motto", "Build like a team of hundreds_");
json.put("learn", "https://appwrite.io/docs");
json.put("connect", "https://appwrite.io/discord");
json.put("getInspired", "https://builtwith.appwrite.io");
// 'context.getRes().json()' is a handy helper for sending JSON
return context.getRes().json(json);
}
}
`
content: SnippetJava
},
{
language: 'swift',
content: `import Appwrite
import AppwriteModels
import Foundation
// This is your Appwrite function
// It's executed each time we get a request
func main(context: RuntimeContext) async throws -> RuntimeOutput {
// Why not try the Appwrite SDK?
//
// Set project and set API key
// let client = Client()
// .setProject(ProcessInfo.processInfo.environment["APPWRITE_FUNCTION_PROJECT_ID"])
// .setKey(context.req.headers["x-appwrite-key"] ?? "")
// You can log messages to the console
context.log("Hello, Logs!")
// If something goes wrong, log an error
context.error("Hello, Errors!")
// The 'context.req' object contains the request data
if context.req.method == "GET" {
// Send a response with the res object helpers
// 'res.text()' dispatches a string back to the client
return context.res.text("Hello, World!")
}
// 'context.res.json()' is a handy helper for sending JSON
return try context.res.json([
"motto": "Build like a team of hundreds_",
"learn": "https://appwrite.io/docs",
"connect": "https://appwrite.io/discord",
"getInspired": "https://builtwith.appwrite.io",
])
}
`
content: SnippetSwift
},
{
language: 'csharp',
content: `namespace DotNetRuntime;
using Appwrite;
using Appwrite.Services;
using Appwrite.Models;
public class Handler {
// This is your Appwrite function
// It"s executed each time we get a request
public async Task Main(RuntimeContext Context)
{
// Why not try the Appwrite SDK?
//
// Set project and set API key
// var client = new Client()
// .SetProject(Environment.GetEnvironmentVariable("APPWRITE_FUNCTION_PROJECT_ID"))
// .SetKey(Context.Req.Headers["x-appwrite-key"]);
// You can log messages to the console
Context.Log("Hello, Logs!");
// If something goes wrong, log an error
Context.Error("Hello, Errors!");
// The 'Context.Req' object contains the request data
if (Context.Req.Method == "GET") {
// Send a response with the res object helpers
// 'Context.Res.Text()' dispatches a string back to the client
return Context.Res.Text("Hello, World!");
}
// 'Context.Res.Json()' is a handy helper for sending JSON
return Context.Res.Json(new Dictionary()
{
{ "motto", "Build like a team of hundreds_" },
{ "learn", "https://appwrite.io/docs" },
{ "connect", "https://appwrite.io/discord" },
{ "getInspired", "https://builtwith.appwrite.io" },
});
}
}
`
content: SnippetCsharp
}
];
</script>

View File

@@ -1,6 +1,6 @@
<script>
import Main from '$lib/layouts/Main.svelte';
import { DEFAULT_DESCRIPTION, DEFAULT_HOST } from '$lib/utils/metadata';
import { DEFAULT_HOST } from '$lib/utils/metadata';
import { TITLE_SUFFIX } from '$routes/titles';
import Templates from './(components)/Templates.svelte';
@@ -14,7 +14,6 @@
import DevelopLocally from './(components)/DevelopLocally.svelte';
import DeploySeamlessly from './(components)/DeploySeamlessly.svelte';
import Testimonials from './(components)/Testimonials.svelte';
import RegionsMap from './(components)/RegionsMap.svelte';
import { PUBLIC_APPWRITE_DASHBOARD } from '$env/static/public';
import ProductCards from '$lib/components/product-pages/product-cards.svelte';

View File

@@ -1,7 +1,7 @@
<script>
import { FooterNav, MainFooter, PreFooter } from '$lib/components';
import Main from '$lib/layouts/Main.svelte';
import { DEFAULT_DESCRIPTION, DEFAULT_HOST } from '$lib/utils/metadata';
import { DEFAULT_HOST } from '$lib/utils/metadata';
import { TITLE_SUFFIX } from '$routes/titles';
import Draft from './(components)/Draft.svelte';
import Schedule from './(components)/Schedule.svelte';
@@ -719,9 +719,6 @@ messaging.create_email(
@media (max-width: 500px) {
flex-direction: column;
gap: 1rem;
& a {
width: 100%;
}
}
}

View File

@@ -238,10 +238,5 @@
color: hsl(var(--web-color-primary));
text-align: center;
}
button {
margin-block-start: 1.5rem;
margin-inline: auto;
}
}
</style>