From b51803b1d81afc4da40b6074a1dee058ad62c494 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 23 Feb 2025 19:45:32 -0600 Subject: [PATCH] feat: Add Deno example with basic addition function and test --- deno/README.md | 22 ++++++++++++++++++++++ deno/deno.json | 8 ++++++++ deno/main.ts | 8 ++++++++ deno/main_test.ts | 6 ++++++ 4 files changed, 44 insertions(+) create mode 100644 deno/README.md create mode 100644 deno/deno.json create mode 100644 deno/main.ts create mode 100644 deno/main_test.ts diff --git a/deno/README.md b/deno/README.md new file mode 100644 index 0000000..6e7d4d4 --- /dev/null +++ b/deno/README.md @@ -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). diff --git a/deno/deno.json b/deno/deno.json new file mode 100644 index 0000000..5b320c2 --- /dev/null +++ b/deno/deno.json @@ -0,0 +1,8 @@ +{ + "tasks": { + "dev": "deno run --watch main.ts" + }, + "imports": { + "@std/assert": "jsr:@std/assert@1" + } +} diff --git a/deno/main.ts b/deno/main.ts new file mode 100644 index 0000000..292ce5f --- /dev/null +++ b/deno/main.ts @@ -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)); +} diff --git a/deno/main_test.ts b/deno/main_test.ts new file mode 100644 index 0000000..3d981e9 --- /dev/null +++ b/deno/main_test.ts @@ -0,0 +1,6 @@ +import { assertEquals } from "@std/assert"; +import { add } from "./main.ts"; + +Deno.test(function addTest() { + assertEquals(add(2, 3), 5); +});