Skip to main content

Posts

Showing posts with the label node

Fetch Quick Sheet

Fetch Quick Sheet Fetch Quick Sheet Fetch Fetch Quick Sheet Fetch fetch('/data.json') .then(response => response.json()) .then(data => { console.log(data) }) .catch(err => ...) Response fetch('/data.json') .then(res => { res.text() // response body (=> Promise) res.json() // parse via JSON (=> Promise) res.status //=> 200 res.statusText //=> 'OK' res.redirected //=> false res.ok //=> true res.url //=> 'http://site.com/data.json' res.type //=> 'basic' // ('cors' 'default' 'error'

Top 10 NPM Packages

A little background Before we begin, I would like to share with you with my personal opinion about the topic. Feel free to discuss this in the comments below. So, of course, 1M packages is a great success, or is it? If you're someone who has been into the JS ecosystem for quite a while now, you know how the situation really looks like. And, while 1M is indeed an impressive number, I think we all agree that only a small fraction of these packages are actually  useful . A great chunk of them is just a big mess - a  graveyard of code  that many of us (JS developers) contributed to. That's where these numbers come from. But why? Well, maybe it's because of NPM's  simplicity ? JavaScript's popularity has grown exponentially in recent times, and with that - NPM registry. The JS code that NPM houses is simple and portable - just like the registry itself. This brings the  "entry level"  pretty low, allowing beginners and starters to use it just like that. Naturall

Node Garbage Collection

Garbage Collection Garbage collection (GC) can have a big impact on the performance of your apps. GC is a process that the Node.js runtime regularly runs to clean up any objects that were created and are not used anymore. If you create a lot of objects in your code (or a dependency does) this can slow down your app. It’s therefore a good idea to keep an eye on this. We shipped GC magic dashboard to make this easy for you! Once you upgrade your node package to  1.2.0  and deploy your app a new  Node.js Heap Statistics  dashboard will appear. Let’s look at what data is on the dashboard! Heap Statistics Node.js reserves memory to store your objects in. This is called the “heap”. The top graph in the dashboard displays the total size of your heap, and how much of it is used. If you see a lot of variation here that’s an indication something might be off. In this screenshot we put some load on this test app, and then stopped requesting pages for a bit. You can clearly see that the Node.js ru