app.js 387 B

12345678910111213141516
  1. // app.js
  2. const express = require('express');
  3. const bodyParser = require('body-parser');
  4. const apiRoutes = require('./routes/apiRoutes');
  5. const cors = require('cors');
  6. const app = express();
  7. const PORT = process.env.PORT || 3000;
  8. app.use(bodyParser.json());
  9. app.use(cors());
  10. app.use('/api', apiRoutes);
  11. app.listen(PORT, () => {
  12. console.log(`Server is running on port ${PORT}`);
  13. });