Step 3
You are now ready to "run" the application. In the terminal, enter the following command:
yarn dev
The command spins up a local server to run your web application at http://localhost:5173/. Open the browser and visit the website:
To stop the server, you must halt the process by pressing
Ctrl
+C
in the terminal.
Aside-1: To run the web application, Vite is using your computer as a server. By default, this server is not accessible over the Web; you can only access it on your local computer. That's where the name localhost comes from. To learn more, check out What is Localhost? Explained for Beginners.
Aside-2: The number 5173
is a port number. In computer networking, a port is a communication endpoint. Port numbers start from 0
. The numbers 0
to 1024
are reserved for privileged services (used by the operating system, etc.). For local development, we usually use numbers $\ge$ 3000
. By default, Vite runs the web application under development on port 5173
. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on.
Aside-3: Vite comes with several goodies, including Hot Module Replacement which efficiently reloads the page in the browser as you update the source code.