Below is a brief code snippet I've provided:
...
const url = typeof process.env.url === 'string' ? process.env.url : {do not start a server}
...
server.start(options, ({ port }) => console.log(`Server is running on http://localhost:${port}`));
Is there a way to handle the case where process.env.url
is not set in order to prevent starting a server? I would like to either throw an error or display a message (as shown in the code sample).