Skip to content

deno serve should support onListen callback #26070

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

Open
lowlighter opened this issue Oct 8, 2024 · 1 comment · May be fixed by #29449
Open

deno serve should support onListen callback #26070

lowlighter opened this issue Oct 8, 2024 · 1 comment · May be fixed by #29449
Labels
feat new feature (which has been agreed to/accepted) serve

Comments

@lowlighter
Copy link
Contributor

Currently with Deno.serve you're able to know on which address you're listening to with onListen, but deno serve does not implement it:

export default {
  onListen:() => { /* call me maybe */ },
  fetch:() => new Response()
}

Use-case:

  • knowing which port was chosen (useful when --port 0)
  • dynamically set --location to allow fetch() on self
  • post-listening setup
  • etc
@bartlomieju
Copy link
Member

@nathanwhit is looking into it

@bartlomieju bartlomieju added feat new feature (which has been agreed to/accepted) serve labels Oct 15, 2024
@bartlomieju bartlomieju changed the title deno serveˋ: onListen` callback deno serve should support onListen callback Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat new feature (which has been agreed to/accepted) serve
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants