Node.js detect require-ed or directly invoked module - Code with Hugo - Aug 27th 2019
Hot off the press
Detect if the current file/module is the entrypoint or import/require-d in Node.js: How does one identify whether a JavaScript file is being run directly (node file.js) or it’s being import/require-d (require(‘./file’) in another JS file).
Updated the “Gear” section on my /uses page.
I’ve also been doing some work on getting Hugo’s image and asset processing pipeline to work for me, I’ve had to create Page Bundles (available since Hugo 0.32) for each of my posts and move a bunch of images around, images should now be smaller (or sized appropriately) which means eg. the homepage went from over 3MB of assets down to ~670KB.
There are more Express, axios and Jest posts coming in the near future.
If you missed it
Avoiding recursion pitfalls: MongoDB nested query clause addition and removal: A case-study on where recursion can be useful for enterprise Node.js applications and how to avoid its common pitfalls like RangeError: Maximum call stack size exceeded.
An enterprise-style Node.js REST API setup with Docker Compose, Express and Postgres: The why and how of enterprise-style Node.js application.
Jest Full and Partial Mock/Spy of CommonJS and ES6 Module Imports: The example repository is available at github.com/HugoDF/mock-spy-module-import.
Super-powered newsletter content with Pocket and Netlify Lambda: An example Netlify Lambda to fetch all “newsletter” posts from Pocket.
From the web
The Essential Guide to Building Balanced Development Teams by Eric Elliott,/@_ericelliott: According to StackOverflow’s 2016 Developer Survey, participating in a mentorship program is more highly correlated with job salary than a PhD, and devs value learning new things over other job motivators like building new things, believing in the company mission, and promotions.
Watch “Keynote: The Challenges of Migrating 150 Microservices to Kubernetes: Keynote from Sarah Wells (Financial Times): Switching Horses Midstream: The Challenges of Migrating 150 Microservices to Kubernetes
Server-side apps with client-side rendering by : My primary goal with this article isn’t to compare these two approaches. If you’re interested in learning more about each approach (and others), I highly recommend this article by Jason Miller and Addy Osmani from Google.
trimstray/nginx-admins-handbook by : Hi-diddle-diddle, he played on his fiddle and danced with lady pigs. Number three said, “Nicks on tricks! I’ll build my house with EN-jin-EKS!”. The Three Little Pigs: Who’s Afraid of the Big Bad Wolf? Before using the Nginx please read Beginner’s Guide.