Skip to content

Run a tiny http-server on your machine with no dependencies like NodeJS, NPM, Nginx, etc

Notifications You must be signed in to change notification settings

searchspring/http-server

 
 

Repository files navigation

GitHub issues GitHub stars GitHub forks CircleCI

Http-Server

Run a web server from your current directory without installing Nginx, Nodejs, NPM, etc.

Basic Functionality

To see basic functionality, run without arguments:

docker run -it --rm -p 8080:8080 -v $(PWD):/public danjellz/http-server

Output:

Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8080
  http://172.17.0.2:8080
Hit CTRL-C to stop the server

You can now visit the site in your web browser:

[Preview]

Daemon Mode

Like many images you can run your container in daemon mode by using the -d switch with the Docker run command:

docker run -d -p 8080:8080 -v $(PWD):/public danjellz/http-server

Tips

Alias

Creating an alias in your ~/.bashrc or ~/.zshrc files can make this command much shorter. Example:

alias http-server="docker run -it --rm -p 8080:8080 -v $(PWD):/public danjellz/http-server"

Allowing you to run the following and mount your current directory

http-server

Source:

Uses the NPM package found here: https://www.npmjs.com/package/http-server

About

Run a tiny http-server on your machine with no dependencies like NodeJS, NPM, Nginx, etc

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Makefile 75.3%
  • Dockerfile 14.5%
  • HTML 10.2%