baojs
baojs copied to clipboard
:sparkles: add listen callback function
i didn't write some tests since we have no proper test integration. but it can be able to merge now.
closes #4
@mattreid1 Is it good enough to be merged?
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 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.