1. super-simple-web-server
A super simple node-express web server with https option for when you quickly need to serve some static files. Package includes self-signed certificates. Don't use this for production.
super-simple-web-server
Package: super-simple-web-server
Created by: garris
Last modified: Mon, 28 Nov 2022 07:21:37 GMT
Version: 1.1.4
License: MIT
Downloads: 158,757
Repository: https://github.com/garris/superSimpleExpressServer

Install

npm install super-simple-web-server
yarn add super-simple-web-server

super-simple-web-server

Serve static files on localhost with http & https.

TO INSTALL

npm install super-simple-web-server

or

Clone repo and run npm install in the root directory.

TO RUN

npm start [</path/to/web/root>] [</path/to/some/middleware>]

Default path

Default path is your current working directory. Override by passing an optional path to your desired web root directory.

Default ports

These can be changed by passing through environment variables when starting the server:
SSWS_HTTP_PORT = http port (defaults to 3000)
SSWS_HTTPS_PORT = https port (defaults to 3001)

Default IP

The default IP 127.0.0.1 which should convieniently map to localhost.

Pro tip: Setting USE_LOCALHOST = false in index.js will instead scan for existing bound IP addresses on your machine via os.networkInterfaces(). The last available will be used.

Point to some middleware

To add middleware set the third arg to a path that resolves to a file exporting a function like so...

module.exports = (app) => {
	app.use(someCoolThingHere);
}

About the self-signed certifictes

Fictious self-signed certs are provided for your development convienience. They will exprire on June 6 2028. Obviously -- you don't want to use these for anything other than private testing in your own bathtub.

See ./certs/ for more info...

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code