Aral Balkan

Mastodon icon RSS feed icon P2P network icon

HTTPS Server

Note: HTTP Server is now Indie Web Server.

HTTPS Server (source, GitHub mirror, npm) is a development server that uses nodecert to automatically provision and use locally-trusted TLS certificates.

Install

npm i -g @ind.ie/https-server

Use

Command-line:

https-server [folder-to-serve] [--port N]

All arguments are optional. By default, a secure HTTPS server will be created to serve the current folder over port 443.

If you do not already have TLS certificates, they will be created for you automatically using nodecert.

All dependencies will be installed automatically for you if they do not exist if you have apt, pacman, or yum (untested) on Linux or if you have Homebrew or MacPorts (untested) on macOS.

API

HTTP Server can also be used programmatically (e.g., with Express).

Example

const httpsServer = require('https-server')
const express = require('express')

const app = express()
app.use(express.static('.'))

const options = {} // (optional) customise your server
const server = httpsServer.createServer(options, app).listen(443, () => {
  console.log(` 🎉 Serving on https://localhost\n`)
})

For more details on the API, please see the readme.

Help wanted

If you get a chance to test HTTPS Server with the following setups, please let me know by opening an issue on the GitHub mirror: