Answer the question
In order to leave comments, you need to log in
How to redirect to localhost:3000?
Good afternoon. I'm currently taking a course in React. Need to point connected api and dev server to the same port.
The api is currently opened on localhost:3001.
The link localhost:3001/api/article provides a list of articles.
On localhost:3000 our application.
It is necessary that the same list of articles be available at the link localhost:3000/api/article, that is, a redirect to localhost:3001/api/article takes place.
In the lesson, it was suggested to write in the webpack config:
devServer: {
proxy: [{
path: '/api/',
target: 'http://localhost:3001'
}],
historyApiFallback: true
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question