Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion cpp/README.md → cpp/starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A simple starter function. Edit `src/main.cc` to get started and create somethin
Sample `200` Response:

```text
Hello, World! 🌎
Hello, World!
```

### `POST`, `PUT`, `PATCH`, `DELETE`
Expand Down
19 changes: 12 additions & 7 deletions cpp/src/main.cc → cpp/starter/src/main.cc
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
#include "../RuntimeResponse.h"
#include "../RuntimeRequest.h"
#include "../RuntimeOutput.h"
#include "../RuntimeContext.h"

namespace runtime {
class Handler {
public:
// This is your Appwrite function
// It's executed each time we get a request
static RuntimeOutput main(RuntimeContext &context) {
// You can log messages to the console
context.log("Hello, Logs! 👋");
context.log("Hello, Logs!");

// If something goes wrong, log an error
context.log("Hello, Errors!");
context.log("Hello, Errors!");

// The `req` object contains the request data
if (context.req.method == "GET") {
// Send a response with the res object helpers
// `context.res.send()` dispatches a string back to the client
return context.res.send("Hello, World! 🌎");
return context.res.send("Hello, World!");
}

// `context.res.json()` is a handy helper for sending JSON
Json::Value response;
response['motto'] = "Build Fast. Scale Big. All in One Place.";
response['learn'] = "https://appwrite.io/docs";
response['connect'] = "https://appwrite.io/discord";
response['getInspired'] = "https://builtwith.appwrite.io";
response["motto"] = "Build Fast. Scale Big. All in One Place.";
response["learn"] = "https://appwrite.io/docs";
response["connect"] = "https://appwrite.io/discord";
response["getInspired"] = "https://builtwith.appwrite.io";
return context.res.json(response);
}
};
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion dart/starter-template/README.md → dart/starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A simple starter function. Edit `lib/main.dart` to get started and create someth
Sample `200` Response:

```text
Hello, World! 🌎
Hello, World!
```

### `POST`, `PUT`, `PATCH`, `DELETE`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ Future<dynamic> main(final context) async {
// .setKey(process.env.APPWRITE_API_KEY);

// You can log messages to the console
context.log('Hello, Logs! 👋');
context.log('Hello, Logs!');

// If something goes wrong, log an error
context.error('Hello, Errors!');
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.send()` dispatches a string back to the client
return context.res.send('Hello, World! 🌎');
return context.res.send('Hello, World!');
}

// `res.json()` is a handy helper for sending JSON
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion deno/starter-template/README.md → deno/starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A simple starter function. Edit `src/main.ts` to get started and create somethin
Sample `200` Response:

```text
Hello, World! 🌎
Hello, World!
```

### `POST`, `PUT`, `PATCH`, `DELETE`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ export default ({ req, res, log, error }: any) => {
// .setKey(Deno.env.get("APPWRITE_API_KEY"));

// You can log messages to the console
log("Hello, Logs! 👋");
log("Hello, Logs!");

// If something goes wrong, log an error
error("Hello, Errors!");
error("Hello, Errors!");

// The `req` object contains the request data
if (req.method === "GET") {
// Send a response with the res object helpers
// `res.send()` dispatches a string back to the client
return res.send("Hello, World! 🌎");
return res.send("Hello, World!");
}

// `res.json()` is a handy helper for sending JSON
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A simple starter function. Edit `src/Index.cs` to get started and create somethi
Sample `200` Response:

```text
Hello, World! 🌎
Hello, World!
```

### `POST`, `PUT`, `PATCH`, `DELETE`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Appwrite" Version="0.4.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ public async Task<RuntimeOutput> Main(RuntimeContext Context)
// .SetKey(Environment.GetEnvironmentVariable("APPWRITE_API_KEY"))

// You can log messages to the console
Context.Log("Hello, Logs! 👋");
Context.Log("Hello, Logs!");

// If something goes wrong, log an error
Context.Error("Hello, Errors!");
Context.Error("Hello, Errors!");

// The `Context.Req` object contains the request data
if (Context.Req.Method === "GET") {
if (Context.Req.Method == "GET") {
// Send a response with the res object helpers
// `Context.Res.Send()` dispatches a string back to the client
return Context.Req.Send("Hello, World! 🌎");
return Context.Res.Send("Hello, World!");
}

// `Context.Res.Json()` is a handy helper for sending JSON
return Context.Res.Json(new()
return Context.Res.Json(new Dictionary<string, object?>()
{
{ "motto": "Build Fast. Scale Big. All in One Place." },
{ "learn": "https://appwrite.io/docs" },
{ "connect": "https://appwrite.io/discord" },
{ "getInspired": "https://builtwith.appwrite.io" },
{ "motto", "Build Fast. Scale Big. All in One Place." },
{ "learn", "https://appwrite.io/docs" },
{ "connect", "https://appwrite.io/discord" },
{ "getInspired", "https://builtwith.appwrite.io" },
});
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion java/starter-template/README.md → java/starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A simple starter function. Edit `src/Main.java` to get started and create someth
Sample `200` Response:

```text
Hello, World! 🌎
Hello, World!
```

### `POST`, `PUT`, `PATCH`, `DELETE`
Expand Down
File renamed without changes.
25 changes: 14 additions & 11 deletions java/starter-template/src/Main.java → java/starter/src/Main.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
package io.openruntimes.java.src;

import io.openruntimes.java.RuntimeContext;
import io.openruntimes.java.RuntimeOutput;
import java.util.HashMap;
import io.appwrite.Client;

Expand All @@ -15,26 +19,25 @@ public RuntimeOutput main(RuntimeContext context) throws Exception {
// .setKey(System.getenv("APPWRITE_API_KEY"));

// You can log messages to the console
context.log("Hello, Logs! 👋");
context.log("Hello, Logs!");

// If something goes wrong, log an error
context.error("Hello, Errors!");
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().send()` dispatches a string back to the client
return context.getRes().send("Hello, World! 🌎");
return context.getRes().send("Hello, World!");
}

Map<String, Object> json = new HashMap<>();
json.put("motto", "Build Fast. Scale Big. All in One Place.");
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
Comment thread
Meldiron marked this conversation as resolved.
return context.getRes().json(new HashMap<String, String>() {
{
put("motto", "Build Fast. Scale Big. All in One Place.");
put("learn", "https://appwrite.io/docs");
put("connect", "https://appwrite.io/discord");
put("getInspired", "https://builtwith.appwrite.io");
}
});
return context.getRes().json(json);
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A simple starter function. Edit `src/Main.kt` to get started and create somethin
Sample `200` Response:

```text
Hello, World! 🌎
Hello, World!
```

### `POST`, `PUT`, `PATCH`, `DELETE`
Expand Down
File renamed without changes.
23 changes: 13 additions & 10 deletions kotlin/starter-template/src/Main.kt → kotlin/starter/src/Main.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
package io.openruntimes.kotlin.src

import io.openruntimes.kotlin.RuntimeContext
import io.openruntimes.kotlin.RuntimeOutput
import io.appwrite.Client
import java.util.HashMap

Expand All @@ -13,25 +17,24 @@ class Main {
// }

// You can log messages to the console
context.log("Hello, Logs! 👋")
context.log("Hello, Logs!")

// If something goes wrong, log an error
context.error("Hello, Errors!")
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.send()` dispatches a string back to the client
return context.res.send("Hello, World! 🌎")
return context.res.send("Hello, World!")
}

// `context.res.json()` is a handy helper for sending JSON
val jsonMap = HashMap<String, String>().apply {
put("motto", "Build Fast. Scale Big. All in One Place.")
put("learn", "https://appwrite.io/docs")
put("connect", "https://appwrite.io/discord")
put("getInspired", "https://builtwith.appwrite.io")
}
return context.res.json(jsonMap)
return context.res.json(mutableMapOf(
"motto" to "Build Fast. Scale Big. All in One Place.",
"learn" to "https://appwrite.io/docs",
"connect" to "https://appwrite.io/discord",
"getInspired" to "https://builtwith.appwrite.io"
))
}
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion node/starter-template/README.md → node/starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A simple starter function. Edit `src/main.js` to get started and create somethin
Sample `200` Response:

```text
Hello, World! 🌎
Hello, World!
```

### `POST`, `PUT`, `PATCH`, `DELETE`
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ export default async ({ req, res, log, error }) => {
// .setKey(process.env.APPWRITE_API_KEY);

// You can log messages to the console
log('Hello, Logs! 👋');
log('Hello, Logs!');

// If something goes wrong, log an error
error('Hello, Errors!');
error('Hello, Errors!');

// The `req` object contains the request data
if (req.method === 'GET') {
// Send a response with the res object helpers
// `res.send()` dispatches a string back to the client
return res.send('Hello, World! 🌎');
return res.send('Hello, World!');
}

// `res.json()` is a handy helper for sending JSON
Expand Down
62 changes: 0 additions & 62 deletions php/starter-template/composer.lock

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion php/starter-template/README.md → php/starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A simple starter function. Edit `src/index.php` to get started and create someth
Sample `200` Response:

```text
Hello, World! 🌎
Hello, World!
```

### `POST`, `PUT`, `PATCH`, `DELETE`
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require 'vendor/autoload.php';
require(__DIR__ . '/../vendor/autoload.php');

use Appwrite\Client;
use Appwrite\Exception;
Expand All @@ -17,16 +17,16 @@
// ->setKey(getenv('APPWRITE_API_KEY'));

// You can log messages to the console
$context->log('Hello, Logs! 👋');
$context->log('Hello, Logs!');

// If something goes wrong, log an error
$context->error('Hello, Errors!');
$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.send()` dispatches a string back to the client
return $context->res->send('Hello, World! 🌎');
return $context->res->send('Hello, World!');
}

// `res.json()` is a handy helper for sending JSON
Expand Down
File renamed without changes.
Loading