Install as you would any NodeJS application.
- Make sure
NodeJS
andnpm
are installed. Runnode -v
andnpm -v
in the command line to ensure they have installed correctly. - Clone this repository and navigate to it in your command line
- Run
npm install
at the root repo's directory - Run
node server.js
to start the server. - Navigate to
http://localhost:3000
on machine it's running on orhttp://some.ip.address:3000
for internal network devices.
All of the exciting ExpressJS stuff can be foundi in server.js
. This is where we can interact with the PC, files, databases.etc. This is not client facing so it's a more secure way of dealing with credentials, or informaiton you don't want exposed, or edit and create files.etc
ExpressJS in this example is serving the public
folder, that means that the public
folder will be working as if it's the root of the site, to the web browser. We can define custom endpoints in the server.js
.
In public/script.js
, I have made a GET
and a POST
call to the ExpressJS server. These calls can be cross referenced in server.js
to see what they are doing.
ExpressJS can be ran in the background using special programs like PM2. This will keep the port open and restart the script if an error occurs.