In Next.js, I can access my application on localhost:3000
, and access to my API from localhost:3000/api/hello
.
Is there any way to do this by using React.js and some other framework like Express.js?
What is the solution if I don't want to use Next.js?
Both on development and production.
EDIT:
In production:
I just deployed my express.js app to my shared hosting using app.listen()
and it works fine because in production we don't or we shouldn't specify the port as I know.
So there's no need to worry about ports being different just because they are in development.
In develoment:
I haven't tried anything yet but as jcubic mentioned maybe we need a proxy.
Via Active questions tagged javascript - Stack Overflow https://ift.tt/qGvtTKg
Comments
Post a Comment