Deploy a Deno application on onesubnet
Deploy a TypeScript/JavaScript app with Deno: deno task, port and environment variables.
Deploy a Deno application on onesubnet
onesubnet runs your TypeScript/JavaScript applications via Deno. Deploy via Git.
1. Prepare the project
- A
deno.jsonwith astarttask:
{
"tasks": {
"start": "deno run --allow-net --allow-env src/main.ts"
}
}
- Listen on the port from the
PORTvariable:
const port = Number(Deno.env.get("PORT") ?? 8000)
Deno.serve({ port }, () => new Response("Hello from Deno"))
2. Deploy
- Connect your Git repository in the panel.
- Build command: (often none — Deno has no build step) leave empty or
deno cache src/main.ts. - Start command:
deno task start.
3. Environment variables
In Settings → Environment. Access via Deno.env.get("...") (add --allow-env).
4. Logs
Live console in the panel.
References
- Deno: https://docs.deno.com/
- Deno.serve: https://docs.deno.com/api/deno/~/Deno.serve