| 508 | }) |
| 509 | |
| 510 | async function start() { |
| 511 | try { |
| 512 | await ensureDb() |
| 513 | |
| 514 | app.listen(PORT, '0.0.0.0', () => { |
| 515 | console.log(`Server running at http://0.0.0.0:${PORT}`) |
| 516 | console.log(`For Android emulator API: http://10.0.2.2:${PORT}`) |
| 517 | console.log(`For iOS simulator API: http://localhost:${PORT}`) |
| 518 | console.log(`Electric shape endpoint: http://localhost:3003/v1/shape`) |
| 519 | }) |
| 520 | } catch (error) { |
| 521 | console.error(`Failed to start shopping-list server`, error) |
| 522 | console.error( |
| 523 | `Did you run 'pnpm db:up' in examples/react-native/shopping-list?`, |
| 524 | ) |
| 525 | process.exit(1) |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | void start() |