0

I have a local Node.js server running on port 3000. I have another dev server for front end using webpack, running on 8080. Node is connected to MySQL server. I want to send data from my Node to front end. My project structure looks like this:-

SampleProject
 -> BackEnd
 -> FrontEnd

Should I use CORS node module? If not how should I send the data?

1 Answer 1

0

The easiest way would be to use webpack-dev-server proxy option to proxy requests from webpack-dev-server (8080) to Node (3000).

Example config:

{
  devServer: {
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:3000'
      }
    }
  }
}
Sign up to request clarification or add additional context in comments.

1 Comment

I have updated my question here. Could you answer it? stackoverflow.com/questions/45553748/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.