Runtimes
Deno
Run on Deno. Install from JSR, permission flags, and passing the app to Deno.serve
import { } from "@senrijs/senri";
import { } from "@senrijs/senri/serve";
const = ();
.("/", () => "Hello, Deno!");
await (); // http://localhost:3927deno run --watch --allow-net --allow-env=PORT,NODE_ENV src/main.ts # the template's deno task devFor a new app, the template is the quickest way.
deno run -A npm:create-senri my-app --template denoTo add it to an existing project, install it from JSR.
deno add jsr:@senrijs/senriPermission flags
| Flag | When you need it |
|---|---|
--allow-net | Always (to listen) |
--allow-env=PORT | To set the port with the PORT environment variable. Without it, 3927 is used without a prompt |
--allow-env=NODE_ENV | To use devtools(). Without it, Senri cannot tell whether this is production, so development mode stays off (and a one-line notice is printed) |
Pass the app to Deno.serve yourself
When you call Deno.serve yourself, pass app.fetch.
.({ : 3927 }, .);Then, unlike with serve(), deciding the port, printing the routes and waiting for in-flight requests when stopping are up to you.
Run in production
Start with NODE_ENV=production. Even if devtools() is still there, it gives no development output.
NODE_ENV=production deno run --allow-net --allow-env=PORT,NODE_ENV src/main.ts