Posts tagged "nodejs"
Found 46 posts tagged nodejs
With Server-sent events you are able to send one-directional events to a web page. Here is an example of how I used this functionality in Minimal Analytics
While building Minimal Analytics I had the need to test a function that was dependent on time. In my case, the function returned the milliseconds until midnight. Here is a simple way to test the function
Web Analytics & dashboards always fascinated me. This is my approach to a self-hosted, simple web analytics solution. It also helped me to get back to Full stack web development, using a clean and testable approach.
Node.js 15 has been released, with exciting changes and improvements!
This is a short summary of my experience while writing a simple HackerNews scraper. As a pure exercise or kata if you want, I tried to apply Clean code, Refactoring and Testing priciples for this small npm module. The task is simple: Get the posts on the front page of https://news.ycombinator.com and parse them.
This happened to me recently, and I couldn't understand the cause. "Suddenly", after updating some npm packages, my npm install was "not working". It exited abrubtly with status code 137, with the error message "Killed".
This is a short summary of what I learned while playing around with my Bangle.js Watch. I managed to - add an application to the Bangle.js (with
create-bangle-app) - send accelerometer data over Bluetoot Low Energy - discover & connect to BLE devices with Node.js - read accelerometer data with Node.js (coming from the watch)
Recently I got myself a treat: a Bangle.js Watch! ⌚️ It's a pretty awesome, open-source watch based on Espruino and Node.js, and much more! 🤓 Read about my experiments here especially for creating a mouse-watch app with Node.js and Bluetooth Low Energy!
How to configure authenticated uplinks with Verdaccio.
You're seeing a blank page saying "HTTP_ERROR 431"? And you're running a Node.js HTTP server, like express or fastify?
In case the
npmregistry goes down, it's wise to have a backup registry.
A long awaited feature of the language and runtime has been released and is available in Node.js 14 (and modern browsers): Optional chaining!
The Nullish coalescing operator in useful to handle default values, without short-circuiting on values that result as
falsy. Falsy values are
devblogis yet another lightweight static site generator. Although there are widely used SSG like 11ty (which this blog was previously based on), Jekyll (also previously used), GatsbyJS and many others, I wanted to get my hands dirty and understand how to make the process of building a static blog even simpler, if possible. Even simpler in the sense of "it does just what I need and nothing more". Install via
npm i -g devblogor create a blog with a one-liner
npx devblog init my-new-blog,
cd my-new-blogand serve with
npx http-server _site 8080. It's that easy. Rebuild the blog by running
npm i -g devblogand then just run
devblogin the main directory) Continue reading my story of building
Example repository and explanation to a practical crawling with browserless and puppeteer.
> Browser automation built for enterprises, loved by developers. browserless.io is a neat service for hosted puppeteer scraping, but there is also the official Docker image for running it locally. I was amazed when I found out about it 🤯! Find the whole source code on Github christian-fei/browserless-example!
Curious about how to call an HTTP API like Twitter or GitHub by authenticating through OAuth (1.0a and 2.0)? Read more about how to do it with Node.js Learn how to create Twitter login with OAuth 1.0a.
Personally I use
dotenvto handle different environments in my Node.js applications. It gives you the ability to specify a
.envfile (generally provisioned on each environment with the corresponding environment variables), along these lines:
An example of connecting to mongodb with the Monk NPM module.
Lately, I was having issues with
lernawhile trying to publish packages from a mono-repo. The problem was that
lerna, sometimes, failed while publishing the changed packages (with the command
lerna publish --conventional-commits)!
If you stumbled upon this article, you are probably seeing the following error message on travis in the deployment stage:
I found it. It found me... Whatever! I came across the only documentation about cloning a git repo with the [
Rate limiting API calls to an HTTP service doesn't have to cumbersome and too complicated. A simple way to achieve this (and that I use all the time) is to combine
Promise.allwith an npm package called
p-limitis used to run multiple promise-returning & async functions with limited concurrency.
Today I sat down and wrote a tiny package called wait-for-user-input. it can be used to wait for
stdininput in a command line script.
Let's say you want to filter odd numbers from a list of numbers, like
[1,3,5]. One way to solve this problem in a functional fashion is to provide an
oddfilter function, that is internally composed by a negation of an
evenfilter on those numbers.
Let's say you made a jQuery plugin and want to have an output (like a list of search results), whose aspect and format can be defined by the user. ### Theory The theory is very simple: With a JSON file/object and the template the user provided you can create a basic templating system.