I have been working on this react app project for a while and am now attempting to develop a server (using node and express) and eventually a database for it (MongoDB).
My client-side react app has been up and running on localhost:3000 but now, after installing express, I'm confused as to whether I accidentally just created two different projects/directories.
My file structure for the whole project is in a screenshot attached.
I now have two package.json files and when I invoke npm start, my express app opens up on localhost:3000. However, I'm now unable to access my react app through npm start.
I'm a new coder and this is my first time doing this project with both the back-end and front-end pieces.
I tried to cd pawsforever to change the directory into my react app and it returned 'no such directory found'
I tried to add the following code to my index.js file in my react app but again, npm start only runs my express app.
const express = require("express");
const app = express();
const port = 3000;
app.get("/", (req, res) => {
res.send("Hello World!");
});
app.listen(port, () => {
console.log(`Example app listening on port ${port}!`);
});
I'm wondering if there is a few lines of code I need to add somewhere to connect these two. Most of what I find online is about creating them both in one directory which perhaps I didn't do.