deno serve --parallel
Is it possible to use the deno serve with fresh? When I try to run deno serve --parallel dev.ts it spun 8 different ports. This is not ideal behavior. deno serve automatically handles the multi worker listening on single port. Is there any way to leverage that for fresh?
The deno serve command is currently not supported with Fresh, but the plan is to move over to that. Currently, Fresh spawns its own server via the Deno.serve JS API.
The
deno servecommand is currently not supported with Fresh, but the plan is to move over to that. Currently, Fresh spawns its own server via theDeno.serveJS API.
A workaround (in fresh 2) is to use the handler right?
yup, that can be used with deno serve
here's a simple serve.ts I created to make this work
It's clear that some of fresh config, like FreshConfig.server, can't be applied here @marvinhagemeister can I do this? Any suggestions?
@marvinhagemeister @fro-profesional : Do you mind sharing how to use --parallel in Fresh 2.x?
Sure:
const app = new App()
.get("/", () => new Response("hello"));
export default {
fetch: app.handler()
};
@marvinhagemeister: Thank you for your quick reply. I assume fetch does the trick, right? Is there a discussion/PR you could point out? I'm just curious the implementation details. That's all. Thanks again.
The relevant docs for deno serve are here https://docs.deno.com/runtime/reference/cli/serve/ . It's something built into Deno and available for everyone, not just Fresh.