DailyJS

DailyJS

The JavaScript blog.


Tagevents
Featured

modules events conferences iojs libraries node npm

Node Roundup: 0.12.5, 0.10.39, io.js 2.3.1, NodeDay, Apey Eye

Posted on .

Node 0.12.5, 0.10.39, io.js 2.3.1

Two new releases of Node just came out. Both releases fix OpenSSL security issues, but 0.12.5 also includes updates for uv and npm.

io.js 2.3.1 was also released this week. One of the big changes in this release is performance improvements for require:

module: The number of syscalls made during a require() have been significantly reduced again (see #1801 from v2.2.0 for previous work), which should lead to a performance improvement (Pierre Inglebert) #1920.

This sounds very nice for large projects.

NodeDay

NodeDay

NodeDay is a conference being held in London on 26th June (this Friday), for free! Speakers include Lin Clark, who writes npm's excellent blog posts, and programmers from the BBC, Red Hat, and other companies that are using Node for interesting things.

nodeday is a Node.js conference by the enterprise, for the enterprise. Now in its second year, this one-day industry conference brings together people from companies that have adopted or are planning to adopt Node.js, and focuses on the issues that these companies face. It gives participants a forum to discuss and share their experiences with Node.js, share advice, tips and tricks, and drive forward both the technology and the community.

I apologise for not writing about this sooner, but I only just found out about it! If you have conferences you want me to cover on DailyJS, you can use the contact forms or message me on Twitter (@alex_young).

I really wanted to go to NodeDay but I can't make it this time.

Apey Eye

Filipe Sousa sent in Apey Eye (GitHub: https://github.com/glazedSolutions/apey-eye, License: MIT, npm: apey-eye):

Apey Eye is an Object-Resource Mapping Node.js API framework that uses next-generation JavaScript features that can be used today, like Classes, Decorators and async/await for maximum expressiveness.

This is a framework for building data layers that map directly to REST APIs. It's a bit like ORM for HTTP. It comes with base classes for routing, REST resources, models, and validation, and the models can serialise data to RethinkDB. To talk to other databases a new base model class would have to be written.

Thanks to ES6, the model syntax is very clean:

let Model = ApeyEye.Model;

class MyModel extends Model {  
    constructor() {
        super(async function() { (...) });
    }

    static async fetch() { (...) }
    static async fetchOne() { (...) }
    async put() { (...) }
    async patch() { (...) }
    async delete() { (...) }
}

To me this looks like C# without the extra syntax for strong typing. The validation API looks similar to what you might have seen before with modules like Mongoose.

I like the idea of object-resource mapping at the HTTP level. In Node web apps we seem to spend a lot of time thinking about HTTP servers and APIs, so this feels like it could reduce the amount of boilerplate required to interface from that step to the database layer.

Featured

libraries events conferences types

Flow, Frontend Conference, jQuery Conference

Posted on .

Flow

If you like strongly typed languages, then there are more options than ever for JavaScript. Other than TypeScript, a major new tool is Flow (GitHub: facebook/flow, License: BSD) from Facebook. Flow allows you to annotate code with comments to get type checking -- this is known as weak mode. You can also use real type annotations, which means you'll have to use the Flow transpiler to deploy code.

Flow is written with OCaml, and it's available through the OPAM package manager (opam install flowtype).

If you want type checking without completely changing JavaScript, then you may like TypeScript. There's even a Flux and React demo:

In this case study, we take an existing React project and attempt to have Flow be able to successfully type check its code. While it will not be an automatic, run the Flow type-checker only one time win, we will show that it does not need to be painful to use Flow on your existing projects.

You Gotta Love Frontend Conference

The You Gotta Love Frontend Conference is being held in Tel Aviv from June 8th through to June 9th, 2015. Tickets are available from 750 NIS, which is about $190. The speakers include Douglas Crockford, Lea Verou, and Martin Kleppe, so it sounds like it'll be worth attending!

jQuery Conference: San Francisco

Famo.us is hosting a jQuery Conference in San Francisco on June 22nd and 23rd:

Famo.us, the JavaScript framework for building beautiful, high-performance web and mobile UIs, is hosting a jQuery conference on June 22nd - 23rd, 2015 at the Regency Ballroom in San Francisco, CA. Tickets go on sale April 1st at 10am PST. We are releasing a limited number of Super Early Bird tickets for $150. After they sell out, we will offer attendees an Early Bird ticket for a week at $225, before the General Admission tickets go on sale for $350.

This is the official jQuery San Francisco conference, which has its own site here: jquerysf.com.

Featured

libraries events books conferences strings

StringFormatter, Hapi.js in Action, FullStack 2015

Posted on .

StringFormatter

Simon Blackwell sent me StringFormatter (GitHub: anywhichway/stringformatter, License: MIT), a string formatting library that aims to go beyond the new ECMAScript string templates. It's a bit like sprintf formatting, but includes some more complex features:

  • Numerical type formatting
  • Date formatting
  • CSS styles
  • Conditional formatting
  • Caching

It can handle expressions like currency as well, which is ideal for web applications when you want to display multiple currency formats. You can use StringFormatter.register to register a formatting for a type. For example, if you had a date formatter object you could associate it with Date like this: StringFormatter.register(Date, dateFormatter, 'Date').

The usual way to format a string is with StringFormatter.format, but you can use StringFormatter.polyfill() to add string formatting to the String object. Format strings are represented with JavaScript-inspired syntax:

StringFormatter.format(  
  "The time is now {Date: {format:'hh:mm'}} and I have {number: {fixed: 2, currency: '$'}}.",
  new Date('2015-03-13T10:01:27.284Z'),
  50.25
);

All format options accept an additional style string, which causes the output to be wrapped in span elements with inline styles.

Ideally this library should be used with a templating system to really cut down on format invocation boilerplate. Simon has included an example for the Ractive template engine.

Hapi.js in Action

Hapi in Action

Hapi.js in Action by Matt Harrison is a book that's dedicated to web development with Hapi.js. It has been released as an early access edition, and pricing starts at $35.99 for the eBook. The planned content includes authentication, building modular applications with plugins, testing, production, proxies, and creating streaming services.

Hapi.js in Action teaches you how to build modern Node-driven applications using Hapi.js. Packed with examples, this book takes you from your first simple server through the skills you'll need to build a complete application. In it, you'll learn how to build websites and APIs, implement caching, authentication, validation, error handling, and a lot more. You'll also explore vital techniques for production applications, such as testing, monitoring, error handling, deployment, and documentation.

The first chapter is available for free, and early access supporters can get chapters two and three as well.

FullStack 2015

FullStack 2015 is an event that's all about JavaScript, Node, and the Internet of Things, that will be held in London on 25th to 27th June. Tickets start at £375 for early bird tickets.

There's currently a FullStack call for papers, so if you're interested in speaking at the conference you've got a week to apply.

Featured

libraries events games modules di

js13k Winners, BottleJS

Posted on .

js13k Winners

Pest Control

The js13k winners have been announced. First place went to Pest Control: Weasels by Siorki, which is like Lemmings in reverse -- instead of saving little critters you have to kill them. It's a surprisingly fun game!

Felipe Alfonso came second with Extreme Mini Massacre, and Aurélio Santos came third with ap11. This is like a simplified GTA 1 clone, all in 13k!

There are 129 games listed on the site. Most genres are covered, and there are even some pretty unique ones like Whistleblower which allows you to use the microphone to whistle different pitches to defeat enemies.

The js13k participants get t-shirts and 3.5" diskettes that contain all of the entries. Just to show off how small browser games can be... For those of us without disk drives, however, the source is at js13kGames on GitHub.

BottleJS

BottleJS (GitHub: young-steveo / bottlejs, License: MIT, Bower: bottlejs, npm: bottlejs) by Stephen Young is a dependency injection micro container.

It's inspired by the AngularJS API. You can register services with bottle.service('Service', Service), and then construct them with bottle.container.Service. Bottle supports middleware, so you can inject functions that intercept requests for providers just before they're made for the first time.

If you're not using AngularJS and have trouble keeping larger applications maintainable and testable, then something like Bottle might help improve your application's structure. The readme has examples and API documentation to get you started.

Featured

libraries events node modules npm

Node Roundup: 0.10.31, One-Shot Budapest, Tenso

Posted on .

0.10.31

Node has been updated to 0.10.31, which includes a newer version of v8, openssl, npm, and bug fixes for some core modules. This includes a fix for fs where fs.readFileSync could leak file descriptors, and a fix for Readable.wrap's handling of objectMode falsy values.

One-Shot Budapest

The NodeConf One-Shot: Budapest conference will be held on November 21th, 2014. Tickets are $100, and talks include:

  • Matteo Collina: Hardware Hacking on Stage
  • Mathias Buus: BitTorrent, p2p with Node.js
  • Julian Gruber: Node.js vs Go
  • Nuno Job: Production Ready Node

Tenso

Tenso (GitHub: avoidwork/tenso, License: BSD-3, npm: tenso) by Jason Mulligan is a REST API facade. It supports caching, DTrace, and decorates response/request objects in a similar way to Express/restify.

var uuid = require( 'keigai' ).util.uuid;

module.exports.get = {  
  '/': [],

  '/reports/tps': function(req, res) {
    res.error(new Error('TPS Cover Sheet not attached'), 785);
  },

  '/uuid': function(req, res) {
    res.respond(uuid(), 200, {'cache-control': 'no-cache'});
  }
};