How to fix a 404 error pulling data from MongoDB - reactjs

I am working on a backend for my React app that pulls the data from MongoDB, but receiving a 404 error whenever I try to launch the app.
Here is how I added axios in App.js file:
Here is the route in server.js file:
But I am getting this error whenever I try to open the main page of the app:
When I launch the database using node server.js command, the database is started successfully.
I don't have much experience for troubleshooting such errors - can anyone please offer some advice?

Related

Sitecore JSS (Headless) + React. Can not deploy app. Status: 403

I am trying to deploy my first react app.
I have followed all the steps according to the instructions.
But when it comes to app deployment I keep getting the same message.
Unexpected response from import status service. The import task is probably still running; check the Sitecore logs for details.
Status message:
Status: [403]
Can anyone help me with this?
Hosts added
Confings and the error
Api is working
please go through my comment on : 403 error when importing a new JSS app to Sitecore 10.2
also make sure your API key and layout service is configured properly e.g. http://myapp.siteco.re/sitecore/api/layout/render/jss?item=/&sc_apikey={YOUR_API_KEY_ID}
Similar kind of issue: 403 error when importing a new JSS app to Sitecore 10.2

React-app deployment to Github Pages - Build Successful but deploy failed

Initially, I deployed my React app (created with create-react-app) to Github Pages and it works fine. However, after a few changes to the src files, I wanted to update the website so I decided to re-deploy the app using npm run deploy and it finishes with Published being printed at the end of the command. On Github, the actions shows that the build is successful, but it's not able to deploy, giving me an error code of 400.
Complete error log from Github is as follow:
Actor: github-pages[bot]
Action ID: 1996792679
Artifact URL: https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/pipelines/workflows/1996792679/artifacts?api-version=6.0-preview
{"count":1,"value":[{"containerId":354579,"size":3092480,"signedContent":null,"fileContainerResourceUrl":"https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/resources/Containers/354579","type":"actions_storage","name":"github-pages","url":"https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/pipelines/1/runs/2/artifacts?artifactName=github-pages","expiresOn":"2022-06-15T05:21:40.7473658Z","items":null}]}
Creating deployment with payload:
{
"artifact_url": "https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/pipelines/1/runs/2/artifacts?artifactName=github-pages&%24expand=SignedContent",
"pages_build_version": "8e6a4594c3e946a3f32ab67af68f527ec66ffc90",
"oidc_token": "***"
}
Failed to create deployment for 8e6a4594c3e946a3f32ab67af68f527ec66ffc90.
{"message":"Deployment request failed for 8e6a4594c3e946a3f32ab67af68f527ec66ffc90 due to in progress deployment. Please cancel c1852e5059b99567d48405d0610990fdc25f0946 first or wait for it to complete.","documentation_url":"https://docs.github.com/rest/reference/repos#create-a-github-pages-deployment"}
Error: Error: Request failed with status code 400
Error: Error: Request failed with status code 400
Sending telemetry for run id 1996792679
I'm very confused with what the error is, has anyone countered a 400 error code before while deploying to Gh Pages?
Additional Note: If you need any additional information, please do comment below as this is my first time deploying react app to github pages so I would love to help you in helping me
UPDATE
You can visit the github repo here: cynclar.github.io
I haven't found a solution, but I have a workaround. If you go to the last working workflow run in the Actions tab (look for a green checkmark), you can click Re-run all jobs, which should deploy your webpage for you, including the latest changes.
Hope this works for the time being until there is a better solution!
GitHub has fixed the issue:
If you navigate to the Actions tab, find the last deployment, and Re-run all jobs, it should work. I have tried this myself and it has been successful!
I'll leave the last answer up in case this doesn't work for anyone.
I had the same issue and this didn't work, re-running the old deploy used the same code and didn't have my changes. I deleted all the workflows from the github Actions tab and then pushing again triggered a new deployment that worked.

react native 404 not found while using deployed endpoint

I'm using React Native to work on my project. The problem I'm facing: it is working perfectly 200 ok while fetching data locally but, when I try to use after deployment it says 404 not found.
What could be the reason?
A 404 error is an HTTP status code that means that the page you were trying to reach, couldn't be found on their server.

Server up and running but webpage not rendering on heroku local

I am in the process of deploying a dynamic, React.js app to Heroku and wanted to test it out by using 'heroku local' to see if it works before pushing it to Heroku. Everything seemed to be working fine with the server - my database console.log message logs to the terminal signifying everything is going well - but when I try to access the website which is on localhost:5000, I get an error message of 'Cannot GET /' and the console prints a message saying , 'Failed to load resource: the server responded with a status of 404 (Not Found)'. My React.js files are all within the build folder which in conjunction with all of the other files, were pushed to git and commited, but for some reason my files are not showing up. I would greatly appreciate if someone could help me determine what went wrong. Sorry if my question is a little vague; please let me know if I can clarify something in better detail as I am fairly new to programming.
I've added a proxy to one of my package.json files to help with url routing; possibly this could be causing the issue?
Also, if it helps at all, a photo of my folders within Visual Studio code are listed below:

Connection Error trying to use Stripe payments with React & Express

I'm trying to integrate Stripe payments into a React project.
I've essentially copied this: https://github.com/rwieruch/react-express-stripe
(but obviously put my own API keys in)...
The frontend seems to be working fine, but I'm getting this error when the payment declines:
"OPTIONS http://localhost:8080/ net::ERR_CONNECTION_REFUSED xhr.js:178"
Any ideas?
ANSWERED: I just needed to launch the app from the backend folder,
node index.js

Resources