Simple Static Http Server
A very light-weight and very simple static HTTP server based on node.js's built-in http
module
Installation
npm install simplatic-http-server
Usage
-
Get access to the main
class
:const StaticServer = defaultOr:
-
Instantiate:
const staticServer = portNumber /*, servePath = process.cwd() */ -
Listen to
portNumber
:await staticServerconsoleOr:
staticServer -
Get access to a file in
servePath
. E. g. type in your browser's address bar:http://127.0.0.1/dir/index.html
(Note: The path ofindex.html
must be`${servePath}/dir/index.html`
on your local machine). -
Turn it off when no more needed:
await staticServer