Using netcat, I need to create a simple server to respond with simple JSON data.
First I am trying with an HTML page:
while true ; do nc -l 8888 < index.html ; done
or even more simply:
netcat -l 8888 < index.html
And then in my browser I do this:
http://localhost:8888/index.html
I also try to connect using netcat:
nc -vz 127.0.0.1 8888
Each of these yields a 'connection refused' result:
localhost [127.0.0.1] 8888 (ddi-tcp-1): Connection refused
How do I resolve this error?