npx-server

🤖No dependency, single script http server with custom controllers (for various debugging purposes)

MIT License

Downloads
112
Stars
0
Committers
3

Created in 2018 - quite old now and not maintained

What's that?

It's just simple HTTP server with

  • autoindexing of directories
  • custom (one file) controllers system which logic is reloading without reloading server.
  • reloading browser (hotloader) if one of files on the hard drive changed
  • everything shipped in one .js file with no dependencies.
  • one command installation

Techniques:

It was written just in plain js without any bundlers to just serve files, but later it was extended gradually with more and more features. It supposed to be just dirty tool to do the job from one file, for some testing. What I'm trying to say is: It's ugly and I never had intention to make it pretty. But it was still fun to build it at some point.

npx npx-server@latest

or

npx npx-server server.js

or

npx npx-server [server_file_name.js] [controllers_directory]

Warning

Server have no XSS protection and might have other security issues. In wrong hands, badly managed it might present security thread.

Script is mostly created for local development/testing purposes with main goal to quickly bring it where it is needed and launch without dependencies.

I wouldn't recommend it to use on production.

Notes

Simple equivalent in python would be:


python -m http.server 8000
# or
python -m SimpleHTTPServer 8000

...from https://docs.docker.com/desktop/mac/networking/