Deno is natively supported on the Runway platform and the following example describes how to deploy an application written in Typescript using the Deno engine.
To run an application, no config should be required, but if you may need additional environment variables or maybe even FFI, then the following table shows available options:
If you’re a little familiar with Deno, these variables map to Deno’s (or deno
CLI) switches for permissions. For more docs and updates, please subscribe to our repository on GitHub.
config variable | default value | description |
---|---|---|
BP_RUNWAY_DENO_VERSION |
v2.1.5 |
the version to use |
BP_RUNWAY_DENO_FILE_VERSION |
runtime.txt |
another fall back for version |
BP_RUNWAY_DENO_PERM_ENV |
PORT |
environment variables |
BP_RUNWAY_DENO_PERM_NET |
true |
network access |
BP_RUNWAY_DENO_PERM_FFI |
false |
FFI for C, Rust, etc. |
BP_RUNWAY_DENO_PERM_READ |
true |
file system (read) |
BP_RUNWAY_DENO_PERM_RUN |
false |
run other executables/scripts |
BP_RUNWAY_DENO_PERM_WRITE |
false |
file system (write) |
BP_RUNWAY_DENO_PERM_ALL |
false |
file system (read, write) |
BP_RUNWAY_DENO_MAIN |
main.ts,server.ts |
entrypoint for deno run |
BP_RUNWAY_DENO_PERM_*
), please see the documentation on deno.com.For brevity, we created a project with deno init
and replaced the example (in main.ts
) with a small server that takes a PORT
variable so we can set the port while deploying the application.
import { serve } from "https://deno.land/std@0.205.0/http/server.ts";
const PORT = parseInt(Deno.env.get("PORT") || "8000", 10);
const handler = (request: Request): Response => {
const url = new URL(request.url);
if (url.pathname === "/") {
console.debug(request)
return new Response("Hello, World!", { status: 200 });
}
return new Response("Not Found", { status: 404 });
};
console.log(`HTTP web server running. Access it at: http://localhost:${PORT}/`);
serve(handler, { port: PORT });
Create an application on Runway:
$ runway app create
INFO checking login status
INFO created app "absolute-deno"
create app absolute-deno: done
next steps:
* commit your changes
* runway app deploy
* runway open
And deploy:
$ runway app deploy && runway open