Here is a quick snippet I use all the time when I want to set up an HTTP server on the fly, without leaving the comfort of my terminal.

This is the command:

$ while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; echo "Hello World"} | nc -l 3000; done

Warning: this will block your current terminal.

You will see the following output as you receive requests:

GET / HTTP/1.1
Host: localhost:3000
User-Agent: curl/7.54.0
Accept: */*

If you want your terminal back, or for any other reason want to put the command in the background while it is running, simply press ctrl+z.

When you are done and want to kill the background process, you can do so with

$ kill %1