Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

Simple Node.js server and client that uses the Net module.

License

Notifications You must be signed in to change notification settings

piotrpdev/node-net-server-and-client

Repository files navigation

Node.js Net Server and Client

Example

Simple Node.js server and client that uses the Net module

Run with Docker

Run a server with Docker by running the following command:

docker run \
       --rm -p 1337:1337 \
       --env IP_ADDRESS=0.0.0.0 \
       --env MODE=server \
       -d \
       razermoon/nnsc:latest

Here is the Docker repo

If you want to get logs, use the following

NAME=logs; \
     docker volume create $NAME && \
     MOUNT=$(docker volume inspect $NAME | grep -oP '(?<="Mountpoint": ")[^"]*') && \
     chmod -R 777 $MOUNT

Then run server using the following command:

docker run \
       --rm \
       -p 1337:1337 \
       --volume logs:/home/node/app/logs \
       --env IP_ADDRESS=0.0.0.0 \
       --env MODE=server \
       -d \
       razermoon/nnsc:latest

Build

Compile:

yarn compile

Start server:

yarn server

Start client:

yarn client

Rename the .env.example to .env and fill out the fields for custom ip.

You can also download the lastest release.