Disclaimer it doesnt work on the university wifi (edoroam). it doesnt connect to the api most likely because the university restricts it. Solution is to use a diffrent wifi that is not limited.
Step one setting up the database
Create this table and a database in pgAdmin4
-- Table: public.history
-- DROP TABLE IF EXISTS public.history;
CREATE TABLE IF NOT EXISTS public.history ( id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), date character varying(255) COLLATE pg_catalog."default", value integer, CONSTRAINT history_pkey PRIMARY KEY (id) )
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.history OWNER to postgres;
Step two estasblish connection on the backend side in server.js AND database.js is this piece of code which need to contain the infomation and user login for YOUR database in order to access it:
const dbConfig = { host: 'localhost', user: 'insert', port: 5432, password: 'insert', database: 'insert' };
step 3 you need to run these in different cmd terminals in the project folder
node server.js (for running the server) npm start (for running the UI) node database.js (for connecting the to the database)
example for server.js Users\you\Documents\reactv2\api> node server.js
thats it!!