I have a app where backend is running on localhost:8000. It should be running on port 3000. For this specific example I am using express server. How can I configure that?
This is my server.js:
const express = require('express');
const cors = require('cors');
const path = require('path');
const testimonialsRoutes = require('./routes/testimonials.routes');
const concertsRoutes = require('./routes/concerts.routes');
const seatsRoutes = require('./routes/seats.routes');
const app = express();
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
app.use(express.static(path.join(__dirname + '/client')));
app.use(cors());
app.use('/api/', testimonialsRoutes);
app.use('/api/', concertsRoutes);
app.use('/api/', seatsRoutes);
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname + '/client/NewWaveFest/public/index.html'));
});
app.use((req, res) => {
res.status(404).json({ message: 'Not found' });
});
app.listen(process.env.PORT || 8000, () => {
console.log('Server is running on port: 8000');
});