Day 48: Deer in the Headlights

This was one of those days where I almost stormed out of the classroom. I had to remind myself that we only have a few more weeks before we’re going to be REALLY confused in our new jobs, and that this is probably a picnic in comparison…

There is something dreadful about learning things piecemeal, and then having to cobble it all together for an assignment—I know…just like real life. Today we combined login/registration screen logic, get and post logic, Node express, listing out file data, etc. into one site. The truly mind-bending thing was that we used Node Express Generator to spit out the scaffolding, and then we had to take all the bits and pieces we’ve learned this week and somehow apply them to this new format.

Among the disasters:

1. My site got completely hosed by the ****ing layout.hbs file. What was a normal-looking index page all of a sudden resembled some mutant atrocity. The only way I can describe it is that it looked like our cat Jack jumped on the keyboard in the middle of coding and then used his ass to press “save.” This particular issue turned out to be due to some random css code I’d somehow copied in by mistake for my login page formatting.

2. Partial hbs files are now unnecessary due to the aforementioned layout.hbs file. This has COMPLETELY wiped out the careful work I’d done previously dividing page contents into the partials. NOT THAT I’M RESENTFUL.

3. I also struggled over trying to figure out if I needed one script file or one per page, seeing as there was overlapping logic.

4. I compared notes with others, and think we all suffered from tiny gremlins scurrying away with what’s left of our brain cells, because many of us could not, for the life of us, remember how the hell we listed out fields into an unordered list, let alone how we previously did gets and posts in AJAX calls.

5. I personally kept getting confused over what went in server code and what went in regular front-end script code—especially since we’ve been introduced to routes, or as I like to call them, the bastard cousins of server script.

I’m hoping to gain more clarity tomorrow, as we have to combine everything into a Friday project that we aren’t starting until 1:00 p.m. The idea is to have NO actual html pages, except for bare-bones, as we have to use Postman (which I barely understand) to test the server code instead.

I have the ugly feeling that I’m not going to have a weekend…

Day 39: I think I can…I think I can…

The big project is coming along! I’ve managed to figure out most of the pages, except for the team edit page, which I should be able to finish tomorrow. I figured out the AJAX command to delete a member, which means I should be able to delete a team. I actually got functionality up and running where, when I create a new team, the server code grabs the new team data and stringifies it. In my page code, the data is then parsed to isolate the team ID. From there, I attach it to the URL to bring over to the team details page. This means you can create a new team, and then are immediately directed to your new team’s details page, where you can start adding members. I sent what I did to the rest of the class so that they could do this, too.

I then spent a good half hour in GitHub Hell, as I made the fatal mistake of switching branches (I was in the wrong one) without pushing what I had done first—which of course was what I just described above. Luckily, I had documented it all in my notes, so I was able to do everything over again. However, I somehow ended up with GitHub conflicts which I didn’t resolve correctly. The only way around it was to do a Git Pull—which, of course was going to hose EVERYTHING I’d just done with my team ID URLSearchParams. Thinking quickly, I copied my entire project to another directory on my C: drive, did the Git Pull, and then copied everything back into my project and pushed it again. This time, it FINALLY pushed to my repo successfully. PHEW!

Day 29: AJAX…not just for scrubbing soap scum!

Today we learned about AJAX calls. Hilarity ensued this afternoon as we all had to create an application shell (some of us may have forgotten to engage GitHub first and had to start over again with the folder in a GitHub repository folder). We fired code for the web server—up to this point, we’ve been relying on the “Live Server” from Visual Studio Code. We’re using something called a REST API. I know it sounds like a high-end day spa, but it stands for “representational state transfer technology for an application program interface that uses HTTP requests to GET, PUT, POST, and DELETE data.

There were a few fits and starts as some people inadvertently killed their web server.

We also used Postman to test out our connection to get data, post data, etc. I know. I can’t get the song out of my head now, either…

EAR WORM!!!

Mr. Postman

I’m happy to report that, as of 9:10 p.m., I got my new entries to post to the JSON file! Now I just need to figure out how to PUT for the update file. Watch—that will probably be tomorrow’s project!