server.js 337 B

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