- This is a repository for sample Deno app deployed on Zeabur.
- In this repository, there are two examples:
- For Fresh framework, please refer to
./fresh-demo - For Typescript, please refer to
./typescript-demo
- For Fresh framework, please refer to
- Follow the commands to bootstrap your Fresh project:
deno run -A -r https://fresh.deno.dev my-project
cd my-project
deno task start- In
./fresh-demo/main.ts, addport: Deno.env.get("PORT")to thestartfunction and listen to the custom port given the.envfile
start(manifest, { plugins: [twindPlugin(twindConfig)], port: Deno.env.get("PORT")}, );- To run locally, copy
.env.defaultsto the new file.env, and assign the port that you would like to run your web application. - Don't add
fresh.gen.tsto your.gitignorefile.
- Use
Deno.env.get("PORT")in your serving function.
import { serve } from "https://deno.land/std@0.140.0/http/server.ts";
function handler(_req: Request): Response {
return new Response("Hello World!");
}
serve(handler, { port: Deno.env.get("PORT") });- Create a file
deno.jsonand add the starting command.
{
"tasks": {
"start": "deno run --allow-net --allow-env --allow-read main.ts"
}
}
- To run locally, copy
.env.defaultsto the new file.env, and assign the port that you would like to run your web application.