A basic Node.js server to serve static files such as HTML, CSS, and JavaScript. This project demonstrates how to create a simple web server using Node.js's built-in http and fs modules, without any external dependencies.
- Serve static HTML, CSS, and JavaScript files
- Basic error handling for 404 and 500 errors
- Support for common MIME types
- Node.js (v14 or higher recommended)
-
Clone the repository:
git clone https://github.com/your-username/simple-node-static-server.git
-
Navigate to the project directory:
cd simple-node-static-server -
Install dependencies (if any):
This project uses only built-in Node.js modules, so no additional dependencies need to be installed.
-
Start the server:
node index.js -
Open your browser and go to:
http://localhost:3000You should see a simple static page served by the Node.js server.
/public
- index.html # Main HTML file
- style.css # CSS styles
- script.js # JavaScript file
/index.js # Node.js server script
package.json # Project metadataThis project is licensed under the MIT License - see the LICENSE file for details.
- This project is intended for educational purposes and demonstrates basic static file serving with Node.js.