Thanks for looking through this guide! If you have any questions getting this up and running, please feel free to submit an Issue or email me at kylpeacock@gmail.com.
If you haven't already, install git and node.js on your device.
- Fork or clone this repository onto your device.
- In your console, run
npm install
to install the required components. - Run
touch .env
to create your hidden, gitignored environment config file. - In .env, configure your environment as follows:
DEV=
TRUE
if you are on desktop, orFALSE
if you are on your raspberry piPORT=
8000
for development,80
or443
for HTTP or HTTPSPASS=
Whatever you want your password to be
- Run
npm start
to launch the server
When you make a POST request to the server, follow this structure:
http://ipaddresshere/API/switches/sw1?password=yourpasswordhere
You will want to configure the Python files to suit your project's needs.
To add or edit a switch, go into saveState.json. Use the first switch as a guide, and add a new object to the switches array.
You can serve your own frontend out of the public folder, and it will be accessible on the root route if you make a get request to your IP address.