This repository has been archived by the owner on Jul 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from Miksier/feat-47-translate-hello-world-fun…
…ction-to-dotnet feat: Add hello world function for .NET
- Loading branch information
Showing
4 changed files
with
101 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
*.swp | ||
*.*~ | ||
project.lock.json | ||
.DS_Store | ||
*.pyc | ||
nupkg/ | ||
|
||
# Visual Studio Code | ||
.vscode | ||
|
||
# Rider | ||
.idea | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
build/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Oo]ut/ | ||
msbuild.log | ||
msbuild.err | ||
msbuild.wrn | ||
|
||
# Visual Studio 2015 | ||
.vs/ | ||
|
||
# Cloud Function Archive | ||
code.tar.gz |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<RootNamespace>HelloWorld</RootNamespace> | ||
</PropertyGroup> | ||
|
||
</Project> |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace HelloWorld | ||
{ | ||
class Program | ||
{ | ||
static async Task Main(string[] args) | ||
{ | ||
Console.WriteLine("Hello World, I'm an Appwrite cloud function written in .NET."); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 🚮 Clean up files in your storage older than XX days | ||
A sample .NET cloud function to help you create and run Java cloud functions in Appwrite | ||
|
||
## 🚀 Building and Packaging | ||
|
||
To package this example as a cloud function, follow these steps. | ||
|
||
```bash | ||
$ cd demos-for-functions/dotnet/hello-world | ||
|
||
$ dotnet publish --runtime linux-x64 --framework net5.0 --no-self-contained | ||
``` | ||
|
||
* Ensure that your output looks like this | ||
``` | ||
HelloWorld -> ......\demos-for-functions\dotnet\hello-world\bin\Debug\net5.0\linux-x64\HelloWorld.dll | ||
HelloWorld -> ......\demos-for-functions\dotnet\hello-world\bin\Debug\net5.0\linux-x64\publish\ | ||
``` | ||
|
||
* Create a tarfile | ||
|
||
```bash | ||
$ tar -C bin/Debug/net5.0/linux-x64 -zcvf code.tar.gz publish | ||
``` | ||
|
||
* Navigate to the Overview Tab of your Cloud Function > Deploy Tag | ||
* Input the command that will run your function (in this case `dotnet HelloWorld.dll`) as your entrypoint command | ||
* Upload your tarfile | ||
* Click 'Activate' | ||
|
||
## ⏰ Schedule | ||
|
||
Head over to your function in the Appwrite console and under the Settings Tab, enter a reasonable schedule time (cron syntax). | ||
|
||
For example: | ||
|
||
- `*/30 * * * *` every 30 minutes | ||
- `0 * * * *` every hour | ||
- `0 0 * * *` every day |