• Home
  • Books
  • Node
  • Testing
  • JavaScript
  • More...
  • Search
  • About
  • Gear & Setup

JavaScript

A collection of 104 posts

#node #javascript #es6

Use ES modules/ES6 import in Node without Babel/Webpack using `esm`

Node has been implementing more and more ES6+ (ESNext) features natively. One of the features that is taking the longest to implement is modules. The reason for this is that Node and npm run on what is called CommonJS, with which you use require('module-name') to import from othe ...

  • Hugo Di Francesco
    Author
3 min read
#javascript #deployment #observablehq

ObservableHQ notebooks for JavaScript demos and prototypes

ObservableHQ is a platform being built by Mike Bostock (creator of the D3 visualisation library), Jeremy Ashkenas (“Made CoffeeScript, Backbone.js, Underscore and other ragbag” from his Twitter bio) and Tom MacWright (creator of the big presentation framework, simple-statistics a ...

  • Hugo Di Francesco
    Author
4 min read
#javascript #es6 #interview #functional programming

Impress interviewers with recursion in JavaScript with ES6 features

There’s nothing as flashy and useful for JavaScript interviews than recursion. If you just want to be impressive with recursion in JavaScript, here are some semi real-world (technical test type) examples. The short definition of a recursive solution to a problem (in computer sci ...

  • Hugo Di Francesco
    Author
4 min read
#javascript #vuejs #web development

Writing multiple Vue components in a single file

Writing multiple components in one file is a pattern from React where some files contain multiple components. Some of those components are “private” to the file/exported component since no other component needs to consume them. ...

  • Hugo Di Francesco
    Author
4 min read
#node #jest #testing #javascript #Sequelize

Mocking/stubbing ES6 classes in tests with examples of Sequelize model unit tests

This post goes through some patterns that can be used to unit test ES6 classes. The examples will use Jest module auto-mocking but should be portable to other module mocking libraries (eg. Proxyquire) with some modifications. In “Using ES6 classes for Sequelize 4 models&rdq ...

  • Hugo Di Francesco
    Author
2 min read
#node #javascript #es6

Why you should wrap your (JavaScript) dependencies

An email sending example. ...

  • Hugo Di Francesco
    Author
2 min read
#javascript #node #graphql #web development

JavaScript GraphQL client requests in Node and the browser using `graphql.js`

An example consuming a GraphQL API in JavaScript from Node and the browser using graphql.js See the example live: https://example.codewithhugo.com/js-graphql-client-example/. Full repo: https://github.com/HugoDF/js-graphql-client-example. ...

  • Hugo Di Francesco
    Author
3 min read
#node #deployment #javascript #tooling

Build and deploy a Vue/React/Vanilla JS app with Parcel and GitHub pages

Parcel allows us to bundle frontend applications with no configuration and GitHub pages affords us a way to deploy them for free. Here’s how to use these two tools together to deploy a JavaScript application. Full example of a repo deployed like this: https://github.com/Hug ...

  • Hugo Di Francesco
    Author
2 min read
#jest #Testing #javascript

When to use Jest snapshot tests: comprehensive use-cases and examples 📸

There’s some nice use-cases for snapshot tests outside of the well-travelled React/Vue UI component ones. In other words, although React and Vue testing with snapshots is pretty well documented, that’s not the only place they’re useful. As a rule of thumb, you c ...

  • Hugo Di Francesco
    Author
6 min read
#node #javascript #Express #Docker #redis

Bring Redux to your queue logic: an Express setup with ES6 and bull queue

There always comes a point in a web application’s life where an operation is best served in the background, this is where queues come in. There are a few queuing solutions in Node. None of them are ridiculously dominant, eg. Kue, RSMQ, Bee Queue, bull. The issue with Kue, R ...

  • Hugo Di Francesco
    Author
11 min read
← Next Posts Page 9 of 11  Previous Posts →

Interested in Alpine.js?

Power up your debugging with the Alpine.js Devtools Extension for Chrome and Firefox. Trusted by over 15,000 developers (rated 4.5 ⭐️).

Install Now close
Code with Hugo
Latest Posts Github