Closed Akbar4242 closed 2 years ago
Hi @Akbar4242 That sounds like your API server is not running? This doesn't appear to be an issue with the repository code that I can reproduce. Can you confirm that you are using the latest code from the master branch and let us know how you are running the project? If you are a student of Brad's then please post a question in the course Q&A and one of us will be along to help you.
Maybe you can try to create setupProxy.js in your client folder and copy this code, also install npm http-proxy-middleware
const { createProxyMiddleware } = require('http-proxy-middleware') module.exports = function (app) { app.use( '/api', createProxyMiddleware({ target: 'http://localhost:5000', changeOrigin: true, }) ) }
@Mnevis-WebDev The project uses CRA and CRA comes with proxy middleware already @Akbar4242 's issue sounds more like his server is not responding, not running or has no end point for the requested url. As this seems to be an issue with the how the project is being run in development by @Akbar4242 and without further information I'll close.
I solved this problem by change the package.json by adding '--ignore client', but I don't know why it works.
"scripts": { "start": "node server", "server": "nodemon server --ignore client", "client": "npm start --prefix client", "dev":"concurrently \"npm run server\" \"npm run client\"" }
Could not proxy request /api/profile/me from localhost:3000 to http://localhost:5000/. [1] See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED). I cant solve this please help me!