mi

Coronavirus: China offers to help North Korea fight pandemic

President Xi Jinping expresses concern about the threat to its neighbour, and offers to help.




mi

Coronavirus: Far-right spreads Covid-19 'infodemic' on Facebook

An investigation details how extremists are trying to exploit the pandemic via the social network.




mi

Coronavirus: Can live-streaming save China's economy?

In China, the live-streaming industry has become an important platform for economic recovery.




mi

Uber says 'no sacred cows' amid coronavirus crisis

The firm has already announced job cuts affecting 14% of its staff, but more measures may be needed.




mi

Xbox: Microsoft reveals first games for Series X console

The Xbox team shows off new footage of the highly anticipated Assassin's Creed: Valhalla.




mi

Coronavirus: 'Plandemic' virus conspiracy video spreads across social media

A slickly-produced "documentary" has exploded across social media, peddling medical misinformation.




mi

Coronavirus: 'Humiliation' as school meal vouchers fail at till

"We had to leave all our shopping," a mother tells BBC News.




mi

Coronavirus: When might Hollywood reopen for business?

Cast and crews might have to quarantine together in the future when filming begins again.




mi

Coronavirus by Air: The spread of Covid-19 in the Middle East

An investigation by BBC News Arabic has found how one Iranian airline contributed to the spread of coronavirus around the Middle East.




mi

How the Covid-19 pandemic is threatening Africa’s wildlife

Park rangers in Africa say the closure of safari tourism is leading to an increase in poaching.




mi

ICYMI: Penguin chicks and new dining ideas

Some of the stories from around the world that you may have missed this week.




mi

Node 14.2.0, plus Deno 1.0 is coming

#337 — May 7, 2020

Read on the Web

✍️ With a few of the links today, this is a good time to note we sometimes link to things we disagree with or that are controversial if they are newsworthy or of relevance to our community. Inclusion is not always endorsement but you can read any summaries we write alongside items to get our take on things ????

Node Weekly

Node v14.2.0 (Current) Released — The latest version of Node gains a new experimental way — assert.CallTracker — to track and verify function calls and the amount of times they occur. Also, require('console').Console now supports different group indentations

Node.js

Deno 1.0: What You Need to Know — Two years ago Ryan Dahl, the original creator of Node, gave a popular talk called 10 Things I Regret About Node.js where he revealed Deno, his prototype of how he'd build a better V8-based JavaScript runtime. With 1.0 due next week, Deno is poised to be a particularly exciting release and this article does a good job of cruising through the reasons why.

David Else

Enhance Node.js Performance with Datadog APM — Debug errors and bottlenecks in your code by tracing requests across web servers and services in your environment. Then correlate between distributed request traces, metrics, and logs to troubleshoot issues without switching tools or contexts. Try Datadog APM free.

Datadog APM sponsor

Deno Weekly: Our Newest Newsletter — We really like what we see from Deno (above) so far, so we're launching a new newsletter all about it! ???? Rather than keep mentioning Deno in Node Weekly, we'll be giving it its own space. Even if you're not planning to use Deno, feel free to subscribe for a while, see what happens, then unsubscribe if it doesn't suit you — the next issue will drop on 1.0's release (due next Wednesday).

Cooperpress

Controlling GUIs Automatically with Nut.js — Write Node code that clicks on things, opens apps, types, clicks buttons, etc. Works on Windows, macOS and Linux. Hit the GitHub repo to learn more or check out some examples.

Simon Hofmann

A Practical Guide to Node Buffers — You’ll often encounter Buffer objects for holding binary data in the form of a sequence of bytes during interactions with the operating system, working with files, network transfers, etc.

DigitalOcean

???? Jobs

Node.js Developer at X-Team (Remote) — Join X-Team and work on projects for companies like Riot Games, FOX, Coinbase, and more. Work from anywhere.

X-Team

Find a Job Through Vettery — Vettery specializes in tech roles and is completely free for job seekers. Create a profile to get started.

Vettery

ℹ️ If you're interested in running a job listing in this newsletter, there's more info here.

???? Articles & Opinions

How to Build a REST Service with Fastify — How to build a basic RESTful service using Fastify, a popular Node Web framework focused on performance/low overheads.

Wisdom Ekpot

▶  How to Use Node.js for Load Testing — A straightforward tour of an approach for hitting a Web site over and over from multiple child processes.

Tom Baranowicz

How to Fix ESLint Errors Upon Save in VS Code — A quick fire tip.

David Walsh

Faster CI/CD for All Your Software Projects Using Buildkite — See how Shopify scaled from 300 to 1800 engineers while keeping their build times under 5 minutes.

Buildkite sponsor

Avoiding Memory Leaks in Node: Best Practices for Performance — Covers very similar ground to another memory leak article we linked recently.

Deepu K Sasidharan

'Some thoughts on the npm acquisition..' — The creator of Hapi and an investor in npm Inc. shared his thoughts on GitHub’s acquisition of npm. I disagree with his conclusion (and his views have also caused concern on Twitter) but it’s nonetheless interesting to get views from behind the curtain.

Eran Hammer

???? Tools, Resources and Libraries

npm 6.14.5 Released — Just a couple of minor bug fixes.

The npm Blog

actions-cli: Monitor Your GitHub Actions in Real Time from the Command Line

Tommaso De Rossi

SQL Template Tag: Tagged Template Strings for Preparing SQL Statements — For use with pg and mysql, for example.

Blake Embrey

webpack-blocks: Configure webpack using Functional Feature Blocks

Andy Wermke

JavaScript Error Tracking with AppSignal v1.3.0 is Here

AppSignal sponsor

FarmHash 3.1: A Node Implementation of Google's High Performance Hash FunctionsFarmHash is a family of non-cryptographic hash functions built by Google mostly for quickly hashing strings.

Lovell Fuller

do-wrapper 4.0: A Node Wrapper for the DigitalOcean v2 API

Matthew Major




mi

Blasian love: The day we introduced our black and Asian families

Blasian - black and Asian - couples now exist in South Africa... but they don't always have an easy time.




mi

Birth in a pandemic: 'You are stronger than you think'

Coronavirus is throwing many birth plans up in the air and leading some health trusts to increase home births.




mi

Dirty streaming: The internet's big secret

Figures suggest that IT now generates as much CO2 as flying, with some arguing it's nearly double.




mi

Coronavirus crisis forces farmers to throw milk away

Some dairy farmers are throwing away thousands of litres amid supply chain disruption due to coronavirus.




mi

Coronavirus: UK chancellor on new microloan scheme for small businesses

Firms will be able to borrow up to £50,000, which will be interest free for the first year.




mi

Millie Small: My Boy Lollipop singer dies aged 72

The singer, who had Jamaica's first million-selling single, dies after suffering a stroke.




mi

Brazil's Amazon: Surge in deforestation as military prepares to deploy

The military is preparing to deploy to the region to try to stop illegal logging and mining.




mi

Building Redux Middleware

After writing my post a few months ago on building your own redux app, I have been asked a couple times to write a guide on creating redux middleware and how it works. This will be a quick post on how you can acheive anything with your own middleware!

##Basic middleware


const customMiddleware = store => next => action => {
  if(action.type !== 'custom') return next(action)
  //do stuff!
}

Applying it:

import { createStore, applyMiddleware, } from 'redux'
import reducer from './reducer'
import customMiddleware from './customMiddleware'

const store = createStore(
  reducer,
  applyMiddleware(customMiddleware)
)

Whaaa? store => next => action => I know that looks confusing. Essentially you are building a chain of functions, it will look like this when it gets called:

//next looks something like this:
let dispatched = null
let next = actionAttempt => dispatched = actionAttempt 

const dispatch = customMiddleware(store)(next)

dispatch({
  type: 'custom',
  value: 'test'
})

All you are doing is chaining function calls and passing in the neccesary data. When I first saw this I was confused a little due to the long chain, but it made perfect sense after reading the article on writing redux tests.

So now that we understand how those chained functions work, let’s explain the first line of our middleware.

if(action.type !== 'custom') return next(action)

There should be some way to tell what actions should go through your middleware. In this example, we are saying if the action’s type is not custom call next, which will pass it to any other middleware and then to the reducer.

##Doing Cool stuff

The official guide on redux middleware covers a few examples on this, I’m going to try to explain it in a more simple way.

Say we want an action like this:

dispatch({
  type: 'ajax',
  url: 'http://api.com',
  method: 'POST',
  body: state => ({
    title: state.title
    description: state.description
  }),
  cb: response => console.log('finished!', response)
})

We want this to do a post request, and then call the cb function. It would look something like this:

import fetch from 'isomorphic-fetch'

const ajaxMiddleware = store => next => action => {
  if(action.type !== 'ajax') return next(action)
  
  fetch(action.url, {
    method: action.method,
    body: JSON.stringify(action.body(store.getState()))
  })
  .then(response => response.json())
  .then(json => action.cb(json))
}

It’s pretty simple really. You have access to every method redux offers in middleware. What if we wanted the cb function to have access to dispatching more actions? We could change that last line of the fetch function to this:

.then(json => action.cb(json, store.dispatch))

Now in the callback, we can do:

  cb: (response, dispatch) => dispatch(newAction(response))

As you can see, middleware is very easy to write in redux. You can pass store state back to actions, and so much more. If you need any help or if I didn’t go into detail enough, feel free to leave a comment below!




mi

2007 Club World Cup Final: Boca Juniors 2-4 AC Milan

In the final of the FIFA Club World Cup Japan 2007, Italian giants AC Milan got two goals from 'Pippo' Inzaghi and one each from Kaka and Alessandro Nesta to become the world's top team.




mi

A young indian fan of Brazil smiles

KOLKATA, INDIA - OCTOBER 28: A young indian fan of Brazil smiles prior the FIFA U-17 World Cup India 2017 3rd Place match between Brazil and Mali at Vivekananda Yuba Bharati Krirangan on October 28, 2017 in Kolkata, India. (Photo by Buda Mendes - FIFA/FIFA via Getty Images)




mi

Philip Foden of England and Juan Miranda of Spain in action

KOLKATA, INDIA - OCTOBER 28: Philip Foden of England and Juan Miranda of Spain in action during the FIFA U-17 World Cup India 2017 Final match between England and Spain at Vivekananda Yuba Bharati Krirangan on October 28, 2017 in Kolkata, India. (Photo by Tom Dulat - FIFA/FIFA via Getty Images)




mi

England's midfielder Phil Foden greets spectators

England's midfielder Phil Foden greets spectators after England's win over Spain in the final FIFA U-17 World Cup football match at the Vivekananda Yuba Bharati Krirangan stadium in Kolkata on October 28, 2017. / AFP / Dibyangshu SARKAR




mi

England's midfielder Phil Foden greets spectators after England's win over Spain

England's midfielder Phil Foden greets spectators after England's win over Spain in the final FIFA U-17 World Cup football match at the Vivekananda Yuba Bharati Krirangan stadium in Kolkata on October 28, 2017. / AFP / Dibyangshu SARKAR




mi

Mission XI Million milestone children at the Jawaharlal Nehru Stadium in New Delhi

Mission XI Million milestone children at the Jawaharlal Nehru Stadium in New Delhi.




mi

Semis set in stone

The four teams who will see us through to the final day of FIFA Futsal World Cup Colombia 2016 have been settled, as Russia and Iran were joined by Argentina and Portugal in the semi-finals.




mi

All smiles for mother/daughter volunteer team

FIFA.com catches up with Miriam Moreno and her daughter Sara Isabel Collazos who have had a great experience working at Colombia 2016 as volunteers.




mi

History in the making for semi-final pair

Argentina and Portugal both have their sights on making their first ever FIFA Futsal World Cup final when they go head to head in Cali. FIFA.com previews the crucial Colombia 2016 semi-final.




mi

Win the trip of a lifetime with #MyClubWCSmile!




mi

Carrillo: We’ll play with the same determination as the Champions League




mi

Gomis and Al Hilal roar into semis




mi

Filipe Luis: We're giving the semi-final maximum priority




mi

Firmino comes off the bench to fire Liverpool into final




mi

Diego: We're dreaming of winning the world title




mi

Firmino writes Liverpool into Club World Cup history




mi

Dmitry Lyskov of Russia celebrates his goal

MEDELLIN, COLOMBIA - SEPTEMBER 27: Dmitry Lyskov of Russia celebrates his goal during the FIFA Futsal World Cup semi-final match between Iran and Russia at Coliseo Ivan de Bedout on September 27, 2016 in Medellin, Colombia. (Photo by Jan Kruger - FIFA/FIFA via Getty Images)




mi

General view of play during the FIFA Futsal World Cup semi-final match

MEDELLIN, COLOMBIA - SEPTEMBER 27: General view of play during the FIFA Futsal World Cup semi-final match between Iran and Russia at Coliseo Ivan de Bedout on September 27, 2016 in Medellin, Colombia. (Photo by Jan Kruger - FIFA/FIFA via Getty Images)




mi

General view of play during the FIFA Futsal World Cup semi-final match

MEDELLIN, COLOMBIA - SEPTEMBER 27: General view of play during the FIFA Futsal World Cup semi-final match between Iran and Russia at Coliseo Ivan de Bedout on September 27, 2016 in Medellin, Colombia. (Photo by Jan Kruger - FIFA/FIFA via Getty Images)




mi

Mehran Alighadr (L) of Iran is brought down by Ivan Milovanov (R) of Russia

MEDELLIN, COLOMBIA - SEPTEMBER 27: Mehran Alighadr (L) of Iran is brought down by Ivan Milovanov (R) of Russia during the FIFA Futsal World Cup Semi-Final match between Iran and Russia at Coliseo Ivan de Bedout stadium on September 27, 2016 in Medellin, Colombia. (Photo by Alex Caparros - FIFA/FIFA via Getty Images)




mi

Players of Russia celebrate at the end of the semi final against Iran

MEDELLIN, COLOMBIA - SEPTEMBER 27: Players of Russia celebrate at the end of the FIFA Futsal World Cup Semi-Final match between Iran and Russia at Coliseo Ivan de Bedout stadium on September 27, 2016 in Medellin, Colombia. (Photo by Alex Caparros - FIFA/FIFA via Getty Images)




mi

Alireza Samimi (C) of Iran jokes with a FIFA Player's Escort in the tunnel

MEDELLIN, COLOMBIA - SEPTEMBER 27: Alireza Samimi (C) of Iran jokes with a FIFA Player's Escort in the tunnel before the FIFA Futsal World Cup Semi-Final match between Iran and Russia at Coliseo Ivan de Bedout stadium on September 27, 2016 in Medellin, Colombia. (Photo by Alex Caparros - FIFA/FIFA via Getty Images)




mi

The stadium is seen prior to the semi-final between Argentina and Portugal

CALI, COLOMBIA - SEPTEMBER 28: The Stadium is seen prior to the FIFA Futsal World Cup Semi Final match between Argentina and Portugal at the Coliseo el Pueblo Stadium on September 28, 2016 in Cali, Colombia. (Photo by Ian MacNicol - FIFA/FIFA via Getty Images)




mi

The Stadium is seen prior to the FIFA Futsal World Cup Semi Final match between Argentina and Portugal

CALI, COLOMBIA - SEPTEMBER 28: The Stadium is seen prior to the FIFA Futsal World Cup Semi Final match between Argentina and Portugal at the Coliseo el Pueblo Stadium on September 28, 2016 in Cali, Colombia. (Photo by Ian MacNicol - FIFA/FIFA via Getty Images)




mi

Damian Stazzone of Argentina celebrates after scoring his team's second goal

CALI, COLOMBIA - SEPTEMBER 28: Damian Stazzone of Argentina celebrates after scoring his team's second goal during the FIFA Futsal World Cup Semi-Final match between Argentina and Portugal at the Coliseo El Pueblo stadium on September 28, 2016 in Cali, Colombia. (Photo by Alex Caparros - FIFA/FIFA via Getty Images)




mi

Damian Stazzone of Argentina celebrates after scoring

Damian Stazzone of Argentina celebrates after scoring his team's second goal during the FIFA Futsal World Cup Semi-Final match between Argentina and Portugal at the Coliseo El Pueblo stadium on September 28, 2016 in Cali, Colombia. (Photo by Alex Caparros - FIFA/FIFA via Getty Images)




mi

Damian Stazzone of Argentina celebrates after scoring

Damian Stazzone of Argentina celebrates after scoring his team's second goal during the FIFA Futsal World Cup Semi-Final match between Argentina and Portugal at the Coliseo El Pueblo stadium on September 28, 2016 in Cali, Colombia. (Photo by Alex Caparros - FIFA/FIFA via Getty Images)




mi

Damian Stazzone (L) of Argentina celebrates as he scores

Damian Stazzone (L) of Argentina celebrates as he scores his team's second goal during the FIFA Futsal World Cup Semi-Final match between Argentina and Portugal at the Coliseo El Pueblo stadium on September 28, 2016 in Cali, Colombia. (Photo by Alex Caparros - FIFA/FIFA via Getty Images)




mi

Damian Sarmiento of Argentina celebrates with team mates

Damian Sarmiento of Argentina celebrates with team mates at the final whistle during the FIFA Futsal World Cup Semi Final match between Argentina and Portugal at the Coliseo el Pueblo Stadium on September 28, 2016 in Cali, Colombia. (Photo by Ian MacNicol - FIFA/FIFA via Getty Images)




mi

Re (R) of Portugal controls the ball next to Alamiro Vaporaki (L) of Argentina

Re (R) of Portugal controls the ball next to Alamiro Vaporaki (L) of Argentina during the FIFA Futsal World Cup Semi-Final match between Argentina and Portugal at the Coliseo El Pueblo stadium on September 28, 2016 in Cali, Colombia. (Photo by Alex Caparros - FIFA/FIFA via Getty Images)