- Install PostgreSQL.
- Install NodeJS.
- Clone this repository (e.g. enter
git clone https://github.com/Happytreat/dynalite.git
in your command-line terminal). - Change directory to the newly created dynalite directory by entering
cd dynalite
.
- Log into psql by entering
psql -U username -d database
. Replace the fields accordingly (e.g.psql -U postgres -d postgres
). - Execute setup.sql by running the command
\i setup.sql
. - Exit psql by entering
\q
.
- Change directory to the src folder by entering the command
cd src
. - Install the required packages by entering
npm install
. - Create a file named .env in the current directory (refer to .env.backup).
- Open .env and enter the following:
DATABASE_URL=postgres://<username>:<password>@<hostname>:<port>/<database_name>
ALGORITHM=<algorithm>
KEY=<key>
Replace the fields in < >
accordingly.
Example:
DATABASE_URL=postgres://postgres:password@localhost:5432/postgres
ALGORITHM=aes-128-cbc
KEY=helloWorldSecureKey21
- 5432 is the default port for PostgreSQL
- Run this project on your local server by using
npm start
. - Stop the server by using
CTRL + C
.
- To test Dynalite without a Raspberry Pi, refer to COAP-CLI. An example command would be:
coap post coap://localhost/ -p "Hello COAP"
. - Dynalite receives POST COAP messages at
coap://localhost/
which are stored in a PostgreSQL table. - Dynalite displays these stored messages at
http://localhost:3000/
.