Categories
Backend JavaScript Node.js

Node.js 8: async/await Goes Native

Node.js 8 is shipping with full async/await support natively, no Babel required. This is the culmination of a multi-year journey from callback hell through Promises to finally having sane async code. But shipping async/await doesn't mean Node.js codebases suddenly become clean—migration is the hard part.

What's New

Node.js 8 includes V8 5.8, which supports async/await from ES2017. You can write this code without any build step:

const fs = require('fs-promise');

async function readConfig() {
  try {
    const data = await fs.readFile('config.json', 'utf8');
    return JSON.parse(data);
  } catch (error) {
    console.error('Failed to read config:', error);
    throw error;
  }
}

async function main() {
  const config = await readConfig();
  console.log('Config loaded:', config);
}

main().catch(console.error);

This is dramatically cleaner than callbacks or even raw Promises. The code reads top-to-bottom, errors propagate naturally, and debugging actually works.

Categories
APIs Backend Web Development

GraphQL: The REST API Alternative You Haven’t Heard Of

Facebook released GraphQL to open source this week. It's their internal data query language, used in production for years, now available for everyone. The pitch: instead of REST endpoints with fixed responses, clients query for exactly what they need.

This is radically different from REST, and if it catches on, it changes how we think about APIs entirely.

What GraphQL Is