Utility server for debugging TCP message communication by echo or by replying pre-defined response.
node server.js
- Start the Echo TCP Server
- Connect and submit data to the server
- The server will echo the data submitted or the predefined response.
Requirement:
- Configure an
.env
file with anAUTOREPLY
setting. - Add your predefined response as a text file in your project.
PORT
: (Number) Server port for listeningHOST
: (String) Server Host or IP for listening
Value: JSON string
It is a key/value pair where the key represent the beginning of the received data and the value is the file system path where to load the response.
For example:
AUTOREPLY=`{
"GET /example/endpointA": "responses/endpointA.txt",
"POST /example/endpointA": "responses/endpointA-post.txt"
}`