I have multiple routes set up, and they are all functioning properly except for the app.get('/') route. When I navigate to 'localhost:3000/', nothing is being displayed in the backend console or on the frontend. The Home component is successfully rendered at the '/' path. Any suggestions on what might be causing this issue?
Here is an excerpt from my app.js (backend) file:
const bodyParser = require('body-parser');
const app = express();
const morgan = require('morgan');
const connection = require('./helpers/db.js');
const session = require('express-session')
// Various middleware configurations and Passport initialization
... (additional code)
app.get('/', (req, res) => {
console.log('heeeeeeere')
res.send('YOU ARE HERE')
});
... (additional routes)
And here are the routes defined in my frontend:
import {MuiThemeProvider} from '@material-ui/core/styles';
import { Grid, Paper } from '@material-ui/core';
import React from 'react';
import './App.css';
import {
BrowserRouter as Router,
Switch,
Route
} from "react-router-dom";
import SignUp from './components/SignUp';
import SignIn from './components/SignIn';
import Profile from './components/Profile';
import Home from './components/Home';
function App() {
return (
<MuiThemeProvider >
... (frontend route setup)
</MuiThemeProvider>
);
}
export default App;