Simon Willison’s Weblog

Subscribe

Items tagged nodejs in Nov

Filters: Month: Nov × nodejs × Sorted by date


now-ab. Intriguing example of a Zeit Now microservice: now-ab is a Node.js HTTP proxy which proxies through to one of two or more other Now-deployed applications based on a cookie. If you don’t have the cookie, it picks a backend at random and sets the cookie. Admittedly this is the easiest part of implementing A/B testing (the hard part is the analytics: tracking exposures and conversions) but as an example of a microservice architectural pattern this is fascinating. # 16th November 2017, 11:03 pm

ZEIT – 6x Faster Now Uploads with HTTP/2 (via) Fantastic optimization write-up by Pranay Prakash. The Now deployment tool works by computing a hash for every local file in a project, then uploading just the ones that are missing. Pranay switched to uploading over HTTP/2 using the fetch-h2 library and got a 6x speedup for larger projects. # 8th November 2017, 1:04 am

Live htop. Neat, simplest-thing-that-could-possibly-work implementation of a tool that continually pipes the output of the htop command to a browser over a WebSocket. The htopgen.sh scripts loops every 2 seconds, runs htop, pipes it through a utility to convert the output to HTML and writes that to a file. Then the server.js Node.js script watches for changes to that file and pipes the entire file contents to the browser via socket.io. The index.html page in the browser subscribes to the WebSocket and updates the entire page using innerHTML every time it receives an event. # 1st November 2017, 6:07 pm

Why is Diaspora built on Ruby on Rails instead of Node.js?

Because Node.js had almost no visibility at all six months ago when Diaspora started. Also, Node.js has only very recently stopped breaking API backwards compatibility on a regular basis. Plus the Ruby library ecosystem is much, much larger than the Node.js ecosystem.

[... 81 words]

Would you recommend using Google Go with web.go, or Node.js for a new web server project which will involve high IO?

If you already know JavaScript, picking up Node.js is pretty easy. It also has a much larger community of web developers around it at the moment than web.go, which means there’s more example code / open source bits and pieces floating around.

[... 69 words]