The right way to console.log afrer the the server is start running is by passing the console console.log function in the optinal callback parameter of server.listen as following:
server.listen(PORT,()=>{
console.log(`server up and running on port ${PORT}!`)
})
https://github.com/FACK1/Countries-autoComplete/blob/4dd217a462dc2d6c0b4f8f9744226206f99dfc44/src/server.js#L7-L8 The Line 8 may be or mostly will be executed before Line 7 given
server.listen
is an Async function.The right way to
console.log
afrer the the server is start running is by passing the consoleconsole.log
function in the optinal callback parameter ofserver.listen
as following: