• Skip to primary navigation
  • Skip to main content
  • Skip to footer

She's Gotta Develop It.com

Notes on web development and programming

  • About
  • Blog
  • Projects
  • code snippets

~/notes & Starter Packs | Wednesday // April 10, 2019

This Week in Coding: #016

Node.js streams, JS arrays, and understanding how templating engines work.

arrays node.js Nunjucks templating engines

0

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 the GET,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.

Post navigation

Previous:
This Week in Coding: #015
Next:
This Week in Coding: #017

Reader Interactions

Leave a Comment Cancel reply

Your email address will not be published. Required fields are marked *

Footer

Archives

  • April 2019
  • March 2019
  • January 2019
  • December 2018
  • November 2018
  • June 2017
  • May 2017
  • December 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016

Categories

  • @snippets
  • ~/notes
  • Code Reviews
  • Meetups & Events
  • Starter Packs
  • Weekly Updates
  • What I Learned Series

Github

shesgottadevelopit (shesgottadevelopit)

shesgottadevelopit

shesgottadevelopit
atlanta via chicago
https://shesgottadevelopit.com
Joined on Feb 06, 2016
16 Public Repositories
dev-log
fit-connect-app
global-content-blocks
iheartcode
JS-DC-Lab-01
JS-DC-Lab-02
lemonade-wp
npm-link-dev
nunjucks-starter
pixartJSdeploy
practicalJS-TodoList
sans-static
virtualhost
W3C_HTML5.1x
wamp-vhost
_s
3 Public Gists
Copyright 2023 ❤ She's Gotta Develop It.com