httpmd
v1.0.0
Published
A simple HTTP server for serving static files and previewing Markdown files
Maintainers
Readme
httpmd
httpmd is a lightweight, zero-config HTTP server designed to serve static files and instantly preview Markdown files with beautiful syntax highlighting. Whether you're a developer sharing documentation, a writer previewing blog posts, or just need a quick static file server, httpmd has you covered. Run it anywhere, access it from any device on your network, and enjoy a seamless experience!
✨ Features
- Markdown Preview: Render
.mdfiles as styled HTML with syntax highlighting powered by highlight.js. - Static File Serving: Serve any file type (HTML, CSS, JS, images, PDFs, etc.) with proper MIME types.
- Directory Listing: Browse directories with clickable links when no
index.htmlis present (configurable for security). - Network Access: Accessible on all network interfaces (e.g.,
192.168.1.5), not justlocalhost. - Customizable Port: Choose your preferred port with a simple flag.
- Security Option: Hide directory listings with
-k/--keepto prevent file exposure. - Visitor Logging: Track visitor IPs, ports, and requested paths with
-l/--look, optionally saving to a log file. - Cross-Platform: Runs on Windows, macOS, Linux—anywhere Node.js is installed.
- No Dependencies Hassle: Only relies on
markedandhighlight.js, bundled for you.
🚀 Installation
Get started in seconds with npm:
npm install -g httpmdThis installs httpmd globally, making the httpmd command available everywhere.
📚 Usage
Run httpmd in any directory to start serving files and previewing Markdown. It's that simple!
Basic Usage
httpmd- Starts the server on port
3000. - Access at
http://localhost:3000or your machine's IP (e.g.,http://192.168.1.5:3000). - Markdown files (
.md) are rendered as styled HTML. - Other files are served as-is.
- Directories list files (unless
-kis used orindex.htmlexists).
Command-Line Options
Customize your server with these flags:
| Flag | Description |
|----------------------|-----------------------------------------------------------------------------|
| -h, --help | Show help with usage and examples. |
| -v, --version | Display the current version (1.0.0). |
| -p, --port <port>| Set a custom port (default: 3000). Example: -p 8080. |
| -k, --keep | Hide directory listings for security (returns 404 if no index.html). |
| -l, --look [<path>] | Log visitor IP, port, and requested path. Optionally save to visitor.log at <path>. |
Examples
Start a server on default port:
httpmd- Serves files at
http://localhost:3000. - Lists directory contents if no
index.html.
- Serves files at
Use a custom port:
httpmd -p 8080- Access at
http://localhost:8080or your IP.
- Access at
Secure mode (hide directory listing):
httpmd -k- Returns 404 for directories without
index.html.
- Returns 404 for directories without
Log visitors to console:
httpmd -l- Outputs:
[2025-04-13T09:05:56.299Z 127.0.0.1:2563 /test.md].
- Outputs:
Log visitors to a file:
httpmd -l ./logs- Saves logs to
./logs/visitor.log.
- Saves logs to
Combine options:
httpmd -p 8080 -k -l ./logs- Runs on port
8080, hides listings, logs to./logs/visitor.log.
- Runs on port
🛠️ Quick Start
Create a Markdown file, e.g.,
test.md:# Welcome to httpmd! This is a **Markdown** file. `Hello, world!`Run the server:
cd your-directory httpmdOpen your browser:
- Visit
http://localhost:3000/test.mdto see the rendered Markdown. - Visit
http://<your-ip>:3000(e.g.,http://192.168.1.5:3000) from another device. - Browse directories or serve
index.htmlif present.
- Visit
📦 Why Choose httpmd?
- Simple: No configuration files needed—just run and go.
- Flexible: Preview Markdown, serve static sites, or share files across your network.
- Secure: Optional directory hiding protects sensitive folders.
- Developer-Friendly: Clean CLI, detailed logging, and MIT-licensed for freedom.
- Lightweight: Minimal dependencies, fast startup.
🐛 Reporting Issues
Found a bug or have a suggestion? Open an issue at GitHub Issues. We appreciate your feedback!
🤝 Contributing
Want to make httpmd even better? Fork the repo, make your changes, and submit a pull request at GitHub. All contributions are welcome!
📝 License
httpmd is licensed under the MIT License. Feel free to use, modify, and distribute it as you see fit.
👨💻 Author
Created by Alexander Ezharjan ([email protected]).
Follow the project on GitHub and star it to show your support! ⭐
Happy serving with httpmd! 🚀
