elafrachy
v1.0.0
Published
Lightweight http server for node.js
Readme
elafrachy
A lightweight Node.js package for creating and hosting HTTP servers, managing static file directories, and handling console commands interactively.
Features
- Host static files, such as HTML, CSS, JS, and images, from a specified directory.
- Monitor and respond to user commands via the console (e.g.,
stopto terminate the server). - Specify the port for the server during initialization.
Installation
npm install elafrachyUsage
import * as ELF from "elafrachy";
const server = new ELF.Server(3000);
server.host("public");
server.connect(() => {
console.log("Server is running on http://localhost:3000");
});Static File Hosting
The server supports hosting files with the following extensions:
.html.css.js.json.png,.jpg,.gif
Error Handling
- 404 Not Found: Returned when a requested file does not exist.
- 500 Internal Server Error: Returned for server-side issues.
License
MIT License
