Step 3
You are now ready to "run" the application. In the terminal, enter the following command:
npm run dev
The command spins up a local server to run your web application at http://localhost:3000/. 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. 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 3000
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 3000
. If you want to use another port, consult Vite's documentation.
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.