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 additional config is required as our buildpack sets sensible defaults. However, if you need additional environment variables or maybe even FFI, then our documentation lists all options available to you.
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