15 lines
576 B
TypeScript
15 lines
576 B
TypeScript
/**
|
|
* Entry point for the compiled server binary.
|
|
* Sets FRESH_ROOT so the server finds _fresh/client and _fresh/server next to the binary, then starts Deno.serve.
|
|
*/
|
|
import { join, dirname } from "https://deno.land/std@0.224.0/path/mod.ts";
|
|
|
|
// Must run before importing the server so the bundle uses this root at load time
|
|
const binDir = dirname(Deno.execPath());
|
|
Deno.env.set("FRESH_ROOT", join(binDir, "_fresh"));
|
|
|
|
const { default: handler } = await import("./_fresh/server.js");
|
|
|
|
const port = Number(Deno.env.get("PORT")) || 8080;
|
|
Deno.serve({ port }, handler.fetch);
|