For the past week was incredible in terms in progress. I was wired and super excited to get through the work required for each of the requirements I established for my static site generator. Yes I’m using a lot of plugins and configuring them is no easy task. Anyway, I’ve enjoyed the progression but I need to simmer down. But it is clear to me that when I can devote more time to these types of things I excel so I’m looking forward to other projects. I’ve learned about just spending more time with documentation and how helpful stackoverflow is when you’re looking for that one edge case. I have a close to production-ready static site generator, just a few more touches to add to it.
A lot of my reading for the week was project focused with some refresher topics in there. On to the main event:
- Intro to NodeJS: I’ve actually never read an intro on why NodeJS is a thing, outside of the Lynda course I took and even with that, it didn’t offer enough explanation. This provided some solid analogies. I found the article trying to learn more about streams. A few key takeaways for me:
Express follows a pattern:
server.VERB('route',callback);
VERB here is any of theGET
,POST
etc, pathname is a string that gets appended to the domain .And the callback is any function we want to fire when the requests come in.
And then on server.use(callback);
Whenever you see a
.use()
method in express, it’s called a middleware. Middlewares are functions that do some http heavy lifting for us. In the code above, the middleware is an error handling one.
- NodeJS streams:Learned about the different types of streams: readable, writeable, duplex, and transform. “Readable streams let you read data from a source while writable streams let you write data to a destination.” Another relevant source I reviewed was Sitepoint’s The Basics of Node.js Streams.
- A refresher on Array methods. I followed along with the examples shared in the article (and this article called “The Almighty Reducer” published earlier on the same topic) and did my own spin on them. Internalizing these concepts requires that I actually do them and not just read them. The hardest one to grasp is
[].reduce
. Like I get it in practice but some of the examples provided in the first article I’ve listed seem like they’re are better solutions for them, but then again I haven’t come across these problems with the awareness that this could be a better solution. Anyway, I did enjoy them and look forward to doing more of these micro-lessons. - Templating engines: As a result of my work with the static site generator I decided to reacquaint myself with templating engines and how they work. I decided to review all my notes from my time at General Assembly and I’m so glad I need. I get how templates are compiled and rendered more now than I did before. I’m also now realizing that taking a little break from code (ok a big almost 1+year break) might’ve been what I needed. I’m so proud of myself. Check out my Nunjucks-Starter kit on Github.