handle-file
v1.0.0
Published
A simple function for serving static files from a "public" folder
Downloads
3
Readme
handle-file
An example function for servind static files from a "public" folder located in the directory.
Example:
"use strict";
const http = require("http");
const handleFile = require("handle-file");
const server = http.createServer();
server.on("request", handleRequest);
server.listen(8080, handleListen);
function handleRequest(req, res) {
handleFile(req, res);
}
function handleListen() {
console.log("Server is listening on port 8080");
}