| 19 | } |
| 20 | |
| 21 | async function checkPortAvailability() { |
| 22 | // Check that the development server is not already running |
| 23 | const portInUse = await portUsed.check(port) |
| 24 | if (portInUse) { |
| 25 | console.log(`\n\n\nPort ${port} is not available. You may already have a server running.`) |
| 26 | console.log( |
| 27 | `Try running \`npx kill-port ${port}\` to shut down all your running node processes.\n\n\n` |
| 28 | ) |
| 29 | console.log('\x07') // system 'beep' sound |
| 30 | process.exit(1) |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | async function startServer() { |
| 35 | const app = createApp() |