Last
Last
KPCKevin Powell - Community
Created by Last on 3/1/2024 in #back-end
PageSpeed Insights and GTMetrix Score Reading Is Difficult
I'm a relatively new developer. Last year I built a CMS in plain PHP, HTML, CSS, and JS, since that was what my boss of the startup company wanted during that time. Optimizing for page speed and PSI was easy because I know where to look since I built the cms and the website. Last November, I found a new job, fairly known to create websites for real estate agents and/or companies. They use wordpress, and a bunch of different plugins related to Real Estate which I'm very not familiar with. I receive daily tasks from updating the contact forms and plugins, to updating layouts and modules of different sites. However, one of my biggest pain points is optimizing for PSI and GTM. In a day if i get one of those kind of task, I feel like giving up. I know it's mainly because I don't fully understand what the score says or what the errors are saying whenever I run a website on those tools. It feels to me like when I change something on a wordpress site that I'm working on, it's never consistent if what I changed was good or bad. For example, I changed one image, and run both tools. at first they might give me a good score, then wait for a bit to run it again, boom, bad score. I tried looking up for YT videos to see If there's someone or something I can learn from optimizing a wordpress site, but all i get is "install this plugin, install that plugin" I need advice. I tried reading google's documentation on it and its kinda overwhelming. I'm a little bit frustrated at myself at this point mainly because when I'm handed these optimizing tasks, It feels like literally don't know anything about web development.
1 replies
KPCKevin Powell - Community
Created by Last on 6/27/2023 in #os-and-tools
npm install speed very slow
i just created a vite project.
npm create vite@latest
npm create vite@latest
continued with the prompts normally, but after i went in the folder
cd myproject
cd myproject
and then installing dependencies
npm install
npm install
it seems like its taking forever. i have a pretty fast internet speed. i don't know whats causing this. sometimes, it even fails saying connection timed out or something. does anyone know what i need to do?
5 replies
KPCKevin Powell - Community
Created by Last on 6/7/2023 in #front-end
How do i handle different logo sizes on a single web page with page load time in mind?
suppose i have 2 same logos on my web page, one is 64px wide, one is 160px wide. is it better to have 2 separate files for their respective resolutions or just 1 file but style the logos' widths in css differently? also, not losing the quality, should i always use svg or is png enough?
6 replies
KPCKevin Powell - Community
Created by Last on 5/27/2023 in #front-end
when making a POST request, an extra key shows up in render.com logs where the BE API is deployed.
i am working on a project for my backend class. I built my backend using PostgresQL and Ruby on Rails for my API. I am having problems with my fetch request from my front end client to the API i deployed on render.com
export const signinLandlord = async (email, password) => {
return fetch(`${baseApiUrl}/api/v1/auth/landlord`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: email,
password: password,
}),
}).then((data) => data.json());
};
export const signinLandlord = async (email, password) => {
return fetch(`${baseApiUrl}/api/v1/auth/landlord`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: email,
password: password,
}),
}).then((data) => data.json());
};
I send a fetch request to the api with only the email and password in the body. In the console, it returns unauthorized EVEN IF the email and password is correct. i checked the logs on render.com where the API is deployed and it gives me this error:
May 27 02:34:19 PM I, [2023-05-27T06:34:19.493672 #73] INFO -- : [219e46fc-cc58-4495-9e89-d14a31281b3b] Started POST "/api/v1/auth/landlord" for 162.158.178.187 at 2023-05-27 06:34:19 +0000
May 27 02:34:19 PM I, [2023-05-27T06:34:19.494462 #73] INFO -- : [219e46fc-cc58-4495-9e89-d14a31281b3b] Processing by Api::V1::AuthenticationController#landlord_create as */*
May 27 02:34:19 PM I, [2023-05-27T06:34:19.494541 #73] INFO -- : [219e46fc-cc58-4495-9e89-d14a31281b3b] Parameters: {"email"=>"landlordone@email.com", "password"=>"[FILTERED]", "authentication"=>{"email"=>"landlordone@email.com", "password"=>"[FILTERED]"}}
May 27 02:34:19 PM I, [2023-05-27T06:34:19.511693 #73] INFO -- : [219e46fc-cc58-4495-9e89-d14a31281b3b] Completed 401 Unauthorized in 17ms (Views: 0.3ms | ActiveRecord: 8.0ms | Allocations: 4790)
May 27 02:34:19 PM I, [2023-05-27T06:34:19.493672 #73] INFO -- : [219e46fc-cc58-4495-9e89-d14a31281b3b] Started POST "/api/v1/auth/landlord" for 162.158.178.187 at 2023-05-27 06:34:19 +0000
May 27 02:34:19 PM I, [2023-05-27T06:34:19.494462 #73] INFO -- : [219e46fc-cc58-4495-9e89-d14a31281b3b] Processing by Api::V1::AuthenticationController#landlord_create as */*
May 27 02:34:19 PM I, [2023-05-27T06:34:19.494541 #73] INFO -- : [219e46fc-cc58-4495-9e89-d14a31281b3b] Parameters: {"email"=>"landlordone@email.com", "password"=>"[FILTERED]", "authentication"=>{"email"=>"landlordone@email.com", "password"=>"[FILTERED]"}}
May 27 02:34:19 PM I, [2023-05-27T06:34:19.511693 #73] INFO -- : [219e46fc-cc58-4495-9e89-d14a31281b3b] Completed 401 Unauthorized in 17ms (Views: 0.3ms | ActiveRecord: 8.0ms | Allocations: 4790)
2 replies
KPCKevin Powell - Community
Created by Last on 5/5/2023 in #os-and-tools
Building a Static Website in a Folder: Relative Paths
I'm not sure how to ask the question properly as I'm not very fluent in english. I know about absolute paths and relative paths. I also know that relative paths can either be relative to the domain or root folder, or relative to the file itself. When I build a static site inside a folder I manually created without the help of builders (e.g. creating a new .html file, .css file, etc manually and structuring it properly inside my folder) I can move that folder wherever I want to, I would only have to make sure that whenever I call an asset inside an html file, the path should be relative to the html file itself, and the website will work almost 100% of the time. However, I noticed that whenever I build a website with the help of a builder (e.g. Astro.build with npm run build command), naturally it spawns a dist folder where the website will live, the website only works if you put it in the root folder of the domain want, or configure the builder to build the website so that it will work in a sub-folder of the domain you want (e.g localhost/subfolder). When the builder builds the website like that, it almost always uses paths relative to the domain or the subfolder of the domain I configured it to, causing it to only work on either the root, or if i configured it to the subfolder, the specific subfolder. The website won't work if I move the folder wherever I want to, like for example if i want the folder in my downloads folder, the index.html file won't look like what i intended it to look because the paths to the assets like the css files and images, all points from the root to where the assets are supposed to be, instead of pointing from the index.html file to the assets. I guess my question is, why does builders almost always use the paths relative to the root? Wouldn't it be very convenient for builders to spawn the dist folder and the website would work anywhere regardless of where the dist folder is?
3 replies