diff --git a/scripts/nc_play/README.md b/scripts/nc_play/README.md new file mode 100644 index 00000000..13706f38 --- /dev/null +++ b/scripts/nc_play/README.md @@ -0,0 +1,2 @@ +This directory is simply to play around with nc. Eventually the hope is to +replace live-server with a nc/websockets implementation in bash. diff --git a/scripts/nc_play/index.html b/scripts/nc_play/index.html new file mode 100644 index 00000000..aaf8ca4f --- /dev/null +++ b/scripts/nc_play/index.html @@ -0,0 +1,12 @@ + + + + + + test + + +

This is a test, and this is more.

+ + + diff --git a/scripts/nc_play/index.js b/scripts/nc_play/index.js new file mode 100644 index 00000000..6687898e --- /dev/null +++ b/scripts/nc_play/index.js @@ -0,0 +1 @@ +console.log('hi') diff --git a/scripts/nc_play/nk b/scripts/nc_play/nk new file mode 100755 index 00000000..ddd6cca0 --- /dev/null +++ b/scripts/nc_play/nk @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +servefile="$1" +port="$2" + +main() { + while : + do + echo -e "HTTP/1.1 200 OK\n\n$(cat "$servefile")" | nc -l -p "$port" -q 1 + done +} + +main diff --git a/scripts/nk b/scripts/nk deleted file mode 100755 index 018c8544..00000000 --- a/scripts/nk +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -servefile="$1" - -while : -do - # echo -e "HTTP/1.1 200 OK\n\n$(echo '

Hi there

')" | nc -l -k -p 8080 -q 1 - echo -e "HTTP/1.1 200 OK\n\n$(cat "$servefile")" | nc -l -k -p 8080 -q 1 -done