serve-local
v1.0.1
Published
Minimalistic local server for static content.
Downloads
8
Readme
Serve local
Minimalistic local server for static content. Creates an instance of Node HTTP Server.
Install
npm i -D serve-local
Setup
Server factory requires 2 parameters - documentRoot and port.
/* Requiring the package. */
const serveLocal = require('serve-local');
/* Arguments */
const documentRoot = 'C:';
const port = '8080';
/* Creating instance. */
const server = serveLocal(documentRoot, port);
require('serve-local')('C:', 8080);
Usage
Server is an instance of Node HTTP Server. It exposes all the events, properties and methods.
/* Close the server. */
server.close(() => console.log('closed'));
/* Checking server status. */
console.log(`Is server listening: ${server.listening}`);