summaryrefslogtreecommitdiff
path: root/cli/factory.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-04-24 15:45:49 -0400
committerGitHub <noreply@github.com>2024-04-24 19:45:49 +0000
commit2f8825a935bfdf21ca592284556cd86c1552ac8d (patch)
tree68beddeb5547861212be188f126113e6b1afc1df /cli/factory.rs
parentc1bd9503dd0288a3c209ca2724d2a1de9d5d122b (diff)
feat: Add `deno serve` subcommand (#23511)
By default, `deno serve` will assign port 8000 (like `Deno.serve`). Users may choose a different port using `--port`. `deno serve /tmp/file.ts` `server.ts`: ```ts export default { fetch(req) { return new Response("hello world!\n"); }, }; ```
Diffstat (limited to 'cli/factory.rs')
-rw-r--r--cli/factory.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/cli/factory.rs b/cli/factory.rs
index 1a0584eea..bfaf96f39 100644
--- a/cli/factory.rs
+++ b/cli/factory.rs
@@ -219,6 +219,7 @@ impl CliFactory {
// Warm up the caches we know we'll likely need based on the CLI mode
match self.options.sub_command() {
DenoSubcommand::Run(_)
+ | DenoSubcommand::Serve(_)
| DenoSubcommand::Bench(_)
| DenoSubcommand::Test(_)
| DenoSubcommand::Check(_) => {
@@ -816,6 +817,8 @@ impl CliFactory {
self.feature_checker().clone(),
self.create_cli_main_worker_options()?,
self.options.node_ipc_fd(),
+ self.options.serve_port(),
+ self.options.serve_host(),
self.options.enable_future_features(),
// TODO(bartlomieju): temporarily disabled
// self.options.disable_deprecated_api_warning,