-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add deno serve
subcommand
#23511
Conversation
deno serve
[WIP]deno serve
b1cdef1
to
67607fb
Compare
deno serve
deno serve
subcommand
Is the documentation currently in a nascent state?
I don't see much at the linked URL — it's currently void of any schema, types, etc. Content of the current documentation
|
The prospect of built-in load balancing is really exciting! I'm guessing this is a very basic feature of any load balancer, but just in case it's worth mentioning: In my case I need a setting for IP-hash-based load balancing, and I need an env variable so an instance can know its own load-balancing index/id. (Also, for those interested in this general "production tooling for Deno" area, Pup looks like a great project to follow: https://github.com/Hexagon/pup - maybe @Hexagon can integrate |
@josephrocca Interesting, thanks for the ping! @mmastrac Would it be possible to assign a port using environment variables instead of cli? As of now, Pup's clustering require a custom server script utilizing the However, if {
"processes": [
{
"id": "my-scalable-app",
"cmd": "deno serve script.ts",
"autostart": true,
"cluster": {
"instances": 4,
"startPort": 8000
}
}
]
} The same scenario using Pup's built in load balancer: (For the record, I'll always recommend a dedicated load balancer, or something like nginx, for production scenarios.) {
"processes": [
{
"id": "my-scalable-app",
"cmd": "deno serve script.ts",
"autostart": true,
"cluster": {
"instances": 4,
"commonPort": 3000,
"startPort": 8000,
"strategy": "ip-hash"
}
}
]
} |
We could definitely use If we add them, we can also probably also set the default port/hostname for |
I'm wondering... I often end up reaching for I haven't thought this through at all, and don't know enough about (Note that |
@josephrocca a bit shorter: deno run --allow-net --allow-read=. jsr:@std/http/file-server |
True, but ooof 😅 the Python command is already slightly too long for my liking. Should be able to type it out in a few keystrokes imo. Deno could make this common DX delightful. |
By default,
deno serve
will assign port 8000 (likeDeno.serve
). Users may choose a different port using--port
.deno serve /tmp/file.ts
server.ts
: