feat: Add Deno example with basic addition function and test

This commit is contained in:
Mauricio Siu
2025-02-23 19:45:32 -06:00
parent be3f772f0b
commit b51803b1d8
4 changed files with 44 additions and 0 deletions

22
deno/README.md Normal file
View File

@@ -0,0 +1,22 @@
# Deno Example
This repository contains an example of Deno application that is deployed on Dokploy.
1. **Use Git Provider in Your Application**:
- Repository: `https://github.com/Dokploy/examples.git`
- Branch: `main`
- Build path: `/deno`
2. **Click on Deploy**:
- Deploy your application by clicking the deploy button.
3. **Generate a Domain**:
- Click on generate domain button.
- A new domain will be generated for you.
- You can use this domain to access your application.
If you need further assistance, join our [Discord server](https://discord.com/invite/2tBnJ3jDJc).

8
deno/deno.json Normal file
View File

@@ -0,0 +1,8 @@
{
"tasks": {
"dev": "deno run --watch main.ts"
},
"imports": {
"@std/assert": "jsr:@std/assert@1"
}
}

8
deno/main.ts Normal file
View File

@@ -0,0 +1,8 @@
export function add(a: number, b: number): number {
return a + b;
}
// Learn more at https://docs.deno.com/runtime/manual/examples/module_metadata#concepts
if (import.meta.main) {
console.log("Add 2 + 3 =", add(2, 3));
}

6
deno/main_test.ts Normal file
View File

@@ -0,0 +1,6 @@
import { assertEquals } from "@std/assert";
import { add } from "./main.ts";
Deno.test(function addTest() {
assertEquals(add(2, 3), 5);
});