const server = require('../app'); const db = require('../model/db'); const PORT = process.env.PORT || 3001; db.then(() => { server.listen(PORT, async () => { console.log(`Server running. Use our API on port: ${PORT}`); }); }).catch((err) => { console.log(`Server not running. Error message: ${err.message}`); process.exit(1); });