Weekly Report
-
4.10.2024
-
Youtube link:https://youtu.be/5iqJy5yKd0E
IDEA - change the code so I can use it specific POST request and not to refresh whole web page but only part of the page. This means not loading whole webpage, but small part of the page when user request the change. For example change the chart appearance
What I have done - I have fetch function in order to get the new data from the database without refreshing the whole web page. This allowed me to have new content for the chart section inside webpage. For now I am using partisl .ejs and fetch function.
PROBLEM - I could not find correct way of doing this solution. I had issue with post request because I did not use json format. I way trying to use AJAX method, but found that fetch works better now. And I could not find ajax video tutorial on the internet. But fetch was possible. This is the idea to make a video lesson on fetch method. Then I could not get the data inside the index.js even the fetch was sending the the post request with the user input. The solution was to include app.use(express.json()); // To parse JSON from POST requests. This allowed to receive json format form the front end.
NEXT - Now I need to make the same solution for other charts that I have. I will make a template so I can simply copy/paste whenever I have new chart on the page. This will allow me to move the charts on any pages with using .ejs partials. This will speed up and simply the use of teh code through whole website.
-
-
1.10.2024
-
Youtube link:
IDEA - change the code so I can use it specific POST request and not to refresh whole web page but only part of the page. This means not loading whole webpage, but small part of the page when user request the change. For example change the chart appearance
What I have done - I have used partials inside .ejs. Check internet on this topic. This means I have separated all charts into separate .ejs file and I am calling them inside .ejs with partials.
PROBLEM - I had issue with calling variable inside partials and whe nI reload webpage I need to pass this variable also. But I did nto send POST request where this variables changes the status. So now I have an issue that i need to resolve.
NEXT - Working still on the code how to implement partisl ejs into code to work wituhout issues. I want to clean the code before I am move forward with new ideas. And I have lots of ideas now :)
-
-
30.9.2024
-
Youtube link: https://youtu.be/TlwLwLRjpx4
IDEA - Changing the code to have / home page and /refresh when new data should be saved into databae. And to have code free from frontend part and backend part.
What I have done - I have separated one function which calls the API and save the data into database and which sends the data to front end part. Now I have two functions, one is for APi calling and sacing new data into database and second one is reading database and sending the data to front end. This way I have clean up the code so I can easilz manipulate data later on. but the function for saving the data into database is free from other functions.
PROBLEM - I had issues with forming database client for calling the database. I had each request with new database connection open/close. But better idea is to have one connection with multiple clients. That was done with pool request that gives client for each connection. const { Pool } = pg;
NEXT - Work on the code to separate main .ejs file into smaller parts so i do nto need to refresh the whole page to refresh the data for one part like one chart. After this change I will request onlz new chart data and the rest of the page will staz the same. This is done with more .ejs files. I have read about this in the udemz course at the beginning. I will return back and watch again how to create more .ejs files and send them from the backend to front end with new data, but only one part of the website page.
-
-
25.9.2024
-
Youtube link: https://youtu.be/TlwLwLRjpx4
IDEA - Put current status to live website on digital ocean droplet
What I have done - I have put the local version of website and database on the digital ocean droplet and now started to promote a little the website to get feedback
PROBLEM - I was solving the issue with the server on digital ocean droplet and succeeded. Nginx config file and root files needed to be put on the correct place
NEXT - Work on the charts appearance and more functionality. Work on design. Work on promoting the website to get feedback.
-