Skip to content

✨ add listen callback function#6

Open
fdemir wants to merge 1 commit into
mattreid1:mainfrom
fdemir:feat/listen-callback-function
Open

✨ add listen callback function#6
fdemir wants to merge 1 commit into
mattreid1:mainfrom
fdemir:feat/listen-callback-function

Conversation

@fdemir

@fdemir fdemir commented Jul 10, 2022

Copy link
Copy Markdown

i didn't write some tests since we have no proper test integration. but it can be able to merge now.

@fdemir

fdemir commented Jul 10, 2022

Copy link
Copy Markdown
Author

closes #4

@fdemir fdemir changed the title ✨ add listen callback funciton ✨ add listen callback function Jul 15, 2022
@eladcandroid

Copy link
Copy Markdown

@mattreid1 Is it good enough to be merged?

@mattreid1

Copy link
Copy Markdown
Owner

I don't have any issue with the code itself, but I struggle to see why it's needed?

As mentioned in #4, app.listen() does not block further code execution and returns the server object. Any code that would be in a callback can just be run after it (see below).

const server = app.listen();
console.log(server.hostname); // http://0.0.0.0:3000/

if (someCondition === true) server.stop();

If I'm missing something let me know!

@fdemir

fdemir commented Aug 8, 2022

Copy link
Copy Markdown
Author

I don't have any issue with the code itself, but I struggle to see why it's needed?

As mentioned in #4, app.listen() does not block further code execution and returns the server object. Any code that would be in a callback can just be run after it (see below).

const server = app.listen();
console.log(server.hostname); // http://0.0.0.0:3000/

if (someCondition === true) server.stop();

If I'm missing something let me know!

i agree with you definitely. i think this feature should exist as optional because of the developer experience which most of people get used to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants