server · April 2024
Serving Static Files with HTTP-Server
http-server is an easy-to-use, zero-configuration command-line HTTP server for serving static files during project development. To get started: 1. Install http-server globally: Run this command in…
http-server is an easy-to-use, zero-configuration command-line HTTP server for serving static files during project development.
To get started:
- Install http-server globally: Run this command in your terminal:
npm install -g http-server
- Run the server without caching: Disable caching to see file changes immediately by running:
http-server -c-1
- Open your browser and navigate to:
localhost:8080
- To quit the server, use:
Press
Ctrl + Cin your terminal to stop the server.
Note: Disabling caching is great for development because it ensures that any changes you make to your static files are immediately reflected in the browser, without the interference of cached versions.