-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
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! π"); | ||
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! π"); | ||
|
||
// If something goes wrong, log an error | ||
context.log("Hello, Errors! β"); | ||
// If something goes wrong, log an error | ||
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! π"); | ||
} | ||
// 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! π"); | ||
} | ||
|
||
// `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"; | ||
|
||
return context.res.json(response); | ||
} | ||
}; | ||
} | ||
// `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"; | ||
return context.res.json(response); | ||
} | ||
}; | ||
} |