Alex's Slip-box

These are my org-mode notes in sort of Zettelkasten style

Zero config HTTP servers

:ID: 0FB30792-CC20-4653-BEC4-F5B47A434CD6

# Why?

For local testing where I need to server a directory.

See also https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server

# Need to expose locally running server to internet?

Use a tunnel like ngrok. For example, if running a server on localhost:8080

ngrok http 8080

With a persistent domain:

ngrok http --domain=https://titmouse-charming-correctly.ngrok-free.app 3000

See also https://github.com/anderspitman/awesome-tunneling for alternatives

# ⭐ http-server

https://www.npmjs.com/package/http-server

This has an option to enable CORS.

http-server -p 3000 --cors

# SimpleHTTPServer

This depends on having python installed. It truly is simple and doesn’t have an option for CORS for example

python -m SimpleHTTPServer 
# or depending on your python version
python3 -m http.server

# emacs-web-server

This uses httpd (apache) under the hood https://github.com/skeeto/emacs-web-server

(httpd-serve-directory) from the current buffer to serve its directory on port 8080

# Parcel

https://parceljs.org/

This is an NPM package.

This will serve on localhost:1234 by default. It supports hot reloading without configuration.

npx parcel index.html

# FTP server

Search Results