feat: Add Deno example with basic addition function and test
This commit is contained in:
22
deno/README.md
Normal file
22
deno/README.md
Normal 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
8
deno/deno.json
Normal 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
8
deno/main.ts
Normal 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
6
deno/main_test.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { add } from "./main.ts";
|
||||
|
||||
Deno.test(function addTest() {
|
||||
assertEquals(add(2, 3), 5);
|
||||
});
|
||||
Reference in New Issue
Block a user