Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React start landing url

Tags:

reactjs

I am new here and I have a question about React JS. I used the create-react-app tool to initialize my application. I wanted to ask how can I change the initial landing page when I start the application.

For example when i am executing 'npm start' it will go to open a new tab in the browser with url 'localhost:3000'. Now I want when I execute this command to open at localhost:3000/api.

Thank you for your time

Nick

like image 757
Nik Avatar asked May 15 '26 12:05

Nik


1 Answers

You can edit the homepage in package.json

"homepage": "https://your website url/route of what you want start with",

for example:

"homepage": "https://icecreamzhao.github.io/api",

When you start the react application, you'll find that the app runs by opening the url http://localhost:3000/api as you expect.

Refer React docs for more info

like image 108
赵泰淇 Avatar answered May 18 '26 02:05

赵泰淇



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!