TopPodcast.com
Menu
  • Home
  • Top Charts
  • Top Networks
  • Top Apps
  • Top Independents
  • Top Podfluencers
  • Top Picks
    • Top Business Podcasts
    • Top True Crime Podcasts
    • Top Finance Podcasts
    • Top Comedy Podcasts
    • Top Music Podcasts
    • Top Womens Podcasts
    • Top Kids Podcasts
    • Top Sports Podcasts
    • Top News Podcasts
    • Top Tech Podcasts
    • Top Crypto Podcasts
    • Top Entrepreneurial Podcasts
    • Top Fantasy Sports Podcasts
    • Top Political Podcasts
    • Top Science Podcasts
    • Top Self Help Podcasts
    • Top Sports Betting Podcasts
    • Top Stocks Podcasts
  • Podcast News
  • About Us
  • Podcast Advertising
  • Contact
Not in our directory?
Add Show Here
Podcast Equipment
Center

toppodcastlogoOur TOPPODCAST Picks

  • Comedy
  • Crypto
  • Sports
  • News
  • Politics
  • True Crime
  • Business
  • Finance

Follow Us

toppodcastlogoStay Connected

    View Top 200 Chart
    Back to Rankings Page
    Software How-To

    CodeWinds – Leading edge web developer news and training | javascript / React.js / Node.js / HTML5 / web development – Jeff Barczewski

    Keep up with the latest web developer technologies and news covering javascript, React.js, Node.js, HTML5. Learn the current best practices in web and mobile app development.

    Advertise

    Copyright: © CodeWinds (c), Inspired Horizons 2019 All rights reserved.

    • Apple Podcasts
    • Google Play
    • Spotify

    Latest Episodes:
    005 Saul Maddox, Software Engineer at PROS, shares insights about his Hapi-Ninja boilerplate and its technology (Node.js, Hapijs web framework, Swig, Gulp) Apr 07, 2014
    Show notes

    SaulMaddox-Photo

    Saul Maddox, a software engineer for PROS, joins me in this episode of CodeWinds to discuss his Hapi-Ninja boilerplate which helps developers get up and running with the Hapi Node.js web framework.

    We discuss in detail the stack he has chosen and the reasons for selecting each:

    • Hapijs Node.js web framework
    • Swig templates
    • Gulp javascript streaming task runner
    • Plugins he has included for assets and routes

    Saul explains the file structure of Hapi-Ninja mentioning how to configure and get up and running with Hapi quickly and easily.

    1. Episode Info
    2. Episode Notes
      1. Episode timeline
    3. Getting started with Hapi-Ninja
    4. Links from Show
      1. Following Saul Maddox

    Episode Info

    • Episode: CW 005
    • Published: April 7th, 2014
    • Tags: js, nodejs,web,framework,boilerplate
    • Duration: 34:17

    Episode Notes

    Episode timeline

    • 02:06 - Introduction to the Hapi-Ninja boilerplate
    • 05:44 - Details of Hapi-Ninja stack
    • 06:00 - Hapi Node.js web framework
    • 08:34 - Swig javascript templates
    • 11:17 - Gulp Node.js streaming task runner
    • 13:52 - Getting started with Hapi-Ninja boilerplate
    • 14:44 - Using a watcher like node-supervisor to auto reload
    • 15:47 - Hapi-Ninja file structure
    • 18:38 - Configuration
    • 18:55 - Hapi-Assets plugin for minimizing and concatenating assets
    • 21:42 - Hapi-Named-Routes plugin
    • 23:31 - Hapi-Cache Buster plugin for easier browser reloading in development
    • 25:26 - Easy switching from full frontend app (PhoneGap) to a frontend and server using same folder structure
    • 27:02 - Hapi-Ninja code is commented heavily to help new users learn
    • 27:41 - Upgrading from Hapi 2.x to 3.x
    • 28:37 - Contributing
    • 30:08 - Other projects
    • 30:25 - Ever Stain project - legacy website for being remembered
    • 32:16 - Following Saul

    Getting started with Hapi-Ninja

    • Install Nodejs
    • Clone repo from GitHub
    • Change working directory into the new path
    • Install dependencies from npm
    # after installing Node.js
    git clone https://github.com/poeticninja/hapi-ninja.git
    cd hapi-ninja
    npm install

    Links from Show

    • Hapi-Ninja boilerplate GitHub Repo
    • Hapijs Node.js web framework
    • Swig templates
    • Gulp javascript streaming task runner
    • Hapi-Named-Routes plugin for using named routes
    • Hapi-Assets plugin for automatically minimizing and concatenating assets
    • Hapi-Cache-Buster plugin which helps with serving fresh content in development
    • Ever Stain legacy website coming soon by Saul Maddox. How will you be remembered?

    Following Saul Maddox

    • Saul Maddox GitHub
    • Saul Maddox Twitter

    004 Pete Hunt, Software Engineer for Facebook, discussing Facebook's open source js UI framework, React Mar 17, 2014
    Show notes

    PeteHunt-Photo

    In this episode, Jeff interviews Pete Hunt, a software engineer with Facebook about Facebook’s hot new open source js UI framework, React. React is a fresh look at how to build UI’s, attempting to improve on the limitations of the past. React gets some of its inspiration from how game engines acehieve awesome performance in their rendering pipeline.

    React can be used in the browser and on the server with node.js so you can have single page apps that are fully indexable by the search engines and have instant load characteristics. React has pluggable backends so it can be used to target the DOM, HTML, canvas, SVG, and other formats.

    The ideas and concepts behind React are very compelling, I encourage you to give it a look.

    1. Episode Info
    2. Episode Notes
      1. Interview timeline
    3. Notable users of React
    4. Resources
      1. Links from Show
      2. Online Training Courses
      3. Tutorials
      4. Other

    Episode Info

    • Episode: CW 004
    • Published: March 17th, 2014
    • Tags: js, nodejs,UI,framework
    • Duration: 42:17
    • Updated: 2014-05-01 Added links to great articles by Reto Schläpfer

    Episode Notes

    Interview timeline

    • 2:08 - What is React and why might people want to use it?
    • 3:08 - The symbiotic relationship of ClojureScript and React
    • 4:54 - The history of React and why it was created
    • 9:43 - Updating web page with React without using data binding, a better approach inspired by game engines
    • 13:11 - Using the virtual DOM to change the browser DOM
    • 13:57 - Programming with React, render target HTML, canvas, other. Javascript is reference implementation of React. Node.js, ClojureScript, other environments.
    • 16:45 - Working with designers. Contrasted with Ember and AngularJS. React encourages building a component architecture.
    • 21:45 - JSX Compiler bridging HTML and React javascript
    • 23:50 - Autobuilding JSX and in browser tools for React
    • 24:50 - Tips and tricks to working with React, suggestions for getting started with React
    • 27:17 - Rendering HTML on the server with Node.js. Pluggable React rendering backends (DOM, HTML, canvas, mixed mode static HTML + background JS binding). Better single page app performance
    • 29:20 - React evolved through survival of the fittest at Facebook
    • 30:15 - Ideas for having state on server and client, possibilities for using React over web sockets.
    • 32:05 - React-multiuser - distributed shared mutable state using Firebase
    • 33:03 - Better debugging with React using the state transitions, rewinding the state to replay the events
    • 34:08 - Differences from Web Components
    • 34:25 - Notable companies using React - Khan Academy, Oscars (Neartime.com), Largest bank in Russia, Facebook, Instagram
    • 35:16 - Could a React backend plugin be created to target PDF?
    • 36:30 - Future of React, what’s next?
    • 39:38 - Contributing and getting help

    Notable users of React

    • Instagram.com is 100% built on React, both public site and internal tools.
    • Facebook.com’s commenting interface, business management tools, Lookback video editor, page insights, and most, if not all, new JS development.
    • Khan Academy uses React for most new JS development.
    • Shirtstarter is 100% built on React.
    • Sberbank, Russia’s number one bank, is built with React.
    • The New York Times’s 2014 Red Carpet Project is built with React.

    Resources

    Links from Show

    • Main Reactjs.org site
    • Github Repo for Reactjs Source
    • Pete Hunt’s Twitter
    • Khan Academy question editor GitHub repo written in React
    • irc: #reactjs on freenode

    Online Training Courses

    • CodeWinds React.js FundamentalsCodeWinds React.js Fundamentals - The premier online course and community where you learn React.js by pragmatically building a real web app while applying TDD/BDD principles
    “Highly recommended!”
    - Kevin Old, Senior Software Engineer
    “Look no further, the React.js Fundamentals course is the only course you will need to become an expert in React.js”
    - Wyatt Preul, Software Architect, nearForm
    “Overall I would give this React.js course a 4-star thumbs up!”- Kevin Bridges - Senior Technical Consultant at Applied Software

    Tutorials

    • Videos and podcasts covering React
    • Getting Started with Reactjs
    • Tutorial for React
    • Thinking in React
    • React examples page
    • JSX javascript XML syntax for React

    Other

    The articles below by Reto Schläpfer are excellent in explaining why you might consider Reactjs vs traditional MVC frameworks.

    • Why you might not need MVC with React.js - Reto Schläpfer
    • React.js vs traditional MVC (Backbone, Angular) - Reto Schläpfer
    • Joel Burget’s blog article and slides about Khan Academy switching from Backbone Views to React
    • Reactjs Google Group
    • Stack Overflow questions on Reactjs

    003 SQLBits - lightweight SQL builder for Node.js for use with Postgres or other ANSI SQL databases Feb 17, 2014
    Show notes

    SQLBits, a lightweight SQL builder for Node.js built by William Wicks, is a great compromise between using native SQL and going to a full ORM (object relational mapping tool). It is small and focused on doing one job, to help you create parameterized queries. One of its unique and killer features is that it can help you create any combination of filter queries from a single complex query based on the parameters used.

    My goal with this podcast is to introduce you to SQLBits and provide some insight as to why it could be a valuable tool in your Node.js toolbox.

    1. Episode Info
    2. Episode Notes
      1. Background - SQL Builder vs ORM
      2. SQLBits - Node.js SQL builder
      3. SQLBits Install
      4. Simple example
      5. Additional criteria
      6. Joins
      7. Filters driven by defined parameters
      8. Inserts
      9. Updates
      10. Deletes
    3. Quick Reference
    4. Resources
    5. Summary

    Episode Info

    • Episode: CW 003
    • Published: February 17th, 2014
    • Tags: nodejs, database
    • Duration: 17:17

    Episode Notes

    Background - SQL Builder vs ORM

    What is a SQL builder and how does that compare to an ORM (Object Relational Mapper)?

    A SQL builder like SQLBits is designed to help you to build safe parameterized SQL with a minimal abstraction layer that still allows you to write optimized SQL queries. Using parameters is important in create SQL to prevent SQL injection attacks where users enter malicious data into forms to gain access to your database. SQL builders help you to use parameters and avoid these attacks.

    Having used Hibernate for Java and Active Record with Rails (a couple of popular Object Relational Mappers, I’ve seen what a ORM’s can do and they are nice when they do what you want, but all to often once you get into more advanced uses, they tend to get in your way and you are fighting with the tool to try to get it to generate the SQL you want.

    So a SQL builder which allows you to create just the right queries but helps you deal with parameterization and tokens, provides a great balance. It stays out of your way and just helps with the bookkeeping. The sql it generates and the parameter array can be used directly with your database module like the pg Postgres client.

    SQLBits - Node.js SQL builder

    I reviewed a bunch of Node.js SQL builders listed in NPM and I was not happy with any of them until I found SQLBits.

    Too many of them seemed complicated or too integrated bordering on ORM capabilities. I wanted something that was simple and just server a single purpose to help me build good parameterized queries. I didn’t want it to run my queries or perform schema manipulation. I don’t want a complete new DSL (domain specific language) or API that I need to learn. SQL is already a DSL that does that just fine, but it can get tricky to manage as queries get complex.

    SQLBits is a simple tool which helps you generate SQL but stays out of your way. You can create custom tuned SQL which pulls back only what is needed over the wire and have it manage the parameters and tokens.

    SQLBits Install

    npm install sqlbits --save  # install and add to package.json

    Simple example

    var bits = require('sqlbits');
    var SQL = bits.SQL;
    var $ = bits.$;
    var AND = bits.AND;
    var params = { max_price: 10.00, clearance: true };
    var query =
      SQL('select name, desc from widgets')
       .WHERE('price < ', $(params.max_price), AND,
              'clearance = ', $(params.clearance))
       .ORDERBY('name asc');
    
    // sql: select name, desc from widgets WHERE(price < $1 AND clearance = $2) ORDER BY name asc
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // params: [ 10, true ]

    Additional criteria

    You can add in additional filter criteria with:

    • AND - bits.AND
    • OR - bits.OR
    • BETWEEN - bits.BETWEEN (discussed in depth later)
    • .IN(array)
    • $ - bits.$ - used to specify that something is a parameter $(params.foo)

    Joins

    With relational data, you will often need to join tables together, and to maintain good performance these joins may need to be optimized. SQLBits allows you to perform any joins you need (left, right, inner, outer) just like you would normally with raw SQL.

    var bits = require('sqlbits');
    var SQL = bits.SQL;
    var query =
      SQL('select w.name, c.type from widgets w ' +
          'join category c on w.categoryID = c.categoryID')
        .ORDERBY('w.name asc');
    
    // OR
    
    var query =
      SQL('select w.name, c.type from widgets w')
        ._('join category c on w.categoryID = c.categoryID')
        .ORDERBY('w.name asc');
    
    // sql: select w.name, c.type from widgets w join category c on w.categoryID = c.categoryID ORDER BY w.name asc
    console.log('sql: ', query.sql);

    The ._() is another way to concatenate sql together.

    Filters driven by defined parameters

    If you have ever had to create SQL with filter clauses that was driven by user input, you should really appreciate this next feature.

    Let’s say for instance that you have a report or catalog that you want to allow the user to provide filter criteria to limit by.

    • If the user doesn’t enter any criteria then return the whole list unfiltered.
    • If they add a minimum price use that in the filter
    • If they add a maximum price limit the rows with that criteria
    • If they include a clearance boolean, use that in the criteria

    Even in this simple example, there are many combinations of possible filters depending on whether the user enters any of the filter data points.

    If you were building this SQL by hand, typically you would create a series of if statements to conditionally include the filter, and you would build up an array of params which you have to manually keep track of.

    However with SQLBits this is child’s play. You only have to create one complex query that includes all the possible filter criteria, and SQLBits will eliminate the parts where the parameters involved are undefined.

    Also by using the BETWEEN command, SQLBits handles all four scenarios automatically:

    • min and max are defined: price BETWEEN $1 AND $2
    • only min is defined: price >= $1
    • only max is defined: price <= $1
    • neither min or max is defined: the criteria is eliminated
    var bits = require('sqlbits');
    var SQL = bits.SQL;
    var $ = bits.$;
    var AND = bits.AND;
    var BETWEEN = bits.BETWEEN;
    
    function queryByParam(params) {
      var query =
        SQL('select name, desc from widgets')
          .WHERE('price', BETWEEN(params.min, params.max), AND,
                 'clearance = ', $(params.clearance))
          .ORDERBY('name asc');
      return query;
    }
    
    var query = queryByParam({ min: 2.00, max: 10.00, clearance: true });
    // sql: select name, desc from widgets WHERE(price BETWEEN $1 AND $2 AND clearance = $3) ORDER BY name asc
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // params: [ 2, 10, true ]
    
    var query = queryByParam({ min: 2.00 });
    // sql: select name, desc from widgets WHERE price >=$1 ORDER BY name asc
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // params: [ 2 ];
    
    var query = queryByParam({ max: 10.00 });
    // sql: select name, desc from widgets WHERE price <=$1 ORDER BY name asc
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // params: [ 10 ]
    
    var query = queryByParam({ min: 2.00, max: 10.00 });
    // sql: select name, desc from widgets WHERE price BETWEEN $1 AND $2 ORDER BY name asc
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // params: [ 2, 10 ]
    
    var query = queryByParam({ min: 2.00, clearance: true });
    // sql:  select name, desc from widgets WHERE(price >=$1 AND clearance = $2) ORDER BY name asc
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // params: [ 2, true ]

    In my opinion, this is one of the killer features of SQLBits. You create a single complex query with all the possible filters and then just provide a params object to SQLBits with a parameters object having the keys that the user wants to filter by, and it provides the customized query.

    This eliminates all the conditional logic which is hard to test and debug when it fails and you are left with a single complex query to maintain.

    Inserts

    Inserting data into your tables by key is as simple as providing an object to SQLBits and it will add all the keys and values.

    var bits = require('sqlbits');
    var INSERT = bits.INSERT;
    
    function insertWidget(obj) {
      return INSERT.INTO('widgets', obj);
    }
    
    var query = insertWidget({ name: 'foo', desc: 'Foo man', price: 23.45 });
    //INSERT INTO widgets (name,desc,price) SELECT $1,$2,$3
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // params: [ 'foo', 'Foo man', 23.45 ]
    
    var query = insertWidget({ name: 'bar', price: 11.23 });
    //INSERT INTO widgets (name,price) SELECT $1,$2
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // params: [ 'bar', 11.23 ]
    
    var query = insertWidget({ name: 'bar' });
    // INSERT INTO widgets (name) SELECT $1
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // params: ['bar']

    Updates

    Updating data works just like the inserts but uses the UPDATE and .SET()

    var bits = require('sqlbits');
    var UPDATE = bits.UPDATE;
    
    function updateWidget(id, updateValues) {
      return UPDATE('widget')
               .SET(updateValues)
               ._('where id=', $(id));
    }
    
    var query = updateWidget(1, { name: 'bar' });
    // sql:  UPDATE widget SET name=$1 where id=$2
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // [ 'bar', 1 ]
    
    var query = updateWidget(2, { name: 'cat', price: 1.12 });
    // UPDATE widget SET name=$1,price=$2 where id=$3
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // [ 'cat', 1.12, 2 ]

    Note: with update’s we don’t want to have the WHERE clause collapse so it is safer to use a non-conditional string with ._('where id = ', $(obj.id)) to there is no chance of the filter clause being collapsed.

    Deletes

    Finally deletes use DELETE.FROM to specify a deletion.

    var bits = require('sqlbits');
    var DELETE = bits.DELETE;
    var params = { id: 10 };
    
    var query = DELETE.FROM('widgets')
                  ._('where id=', $(params.id));
    
    // sql: DELETE FROM widgets where id=$1
    console.log('sql: ', query.sql);
    console.log('params: ', query.params); // [ 10 ]

    Note: with delete’s we don’t want to have the WHERE clause collapse so it is safer to use a non-conditional string with ._('where id = ', $(obj.id)) to there is no chance of the filter clause being collapsed.

    Quick Reference

    var bits = require('sqlbits');
    var SQL = bits.SQL; // SQL('select name, desc from widgets')
    var $ = bits.$; // SQL('...').WHERE('id=', $(obj.id));
    var AND = bits.AND; // .WHERE('id=', $(obj.id), AND, 'type=', $(obj.type));
    var OR = bits.OR; // .WHERE('type=', $(obj.type), OR, 'color=', $(obj.color));
    var IN = bits.IN; // .WHERE('id', IN(array));
    var BETWEEN = bits.BETWEEN; // .WHERE(price, BETWEEN($(obj.min), $(obj.max));
    var INSERT = bits.INSERT; // INSERT.INTO('widgets', obj)
    var UPDATE = bits.UPDATE; // UPDATE('widgets').SET(updateValues)._('where id = ', $(obj.id))
    var DELETE = bits.DELETE; // DELETE.FROM('widgets')._('where id = ', $(obj.id))

    Methods to help chain

    • ._() - appends to the SQL after adding a space
    • .WHERE(...) - add a where clause which checks the params that are defined to conditionally add the filter criteria
    • .SET(updateValues) - used with UPDATE to provide the field names and values to update
    • .FROM('mytable') - used with DELETE to specify table
    • .ORDERBY('name asc, qty desc') - add sorting criteria
    • .LIMIT(number) - limit the max rows returned, defaults to 0
    • .OFFSET(number) - start rows at offset (for paging), defaults to 0

    Accessor properties

    • .sql - get the parameterized SQL string
    • .params - get the array of parameters to use with the SQL

    Resources

    • SQLBits - GitHub repo and project readme. This brief page provides examples of how to use SQLBits and is a great place to get started

    Summary

    SQLBits is a nice lightweight way to create safe parameterized SQL for Postgres or other ANSI SQL databases. It focuses on simply helping you build the SQL by managing the parameterization process, but you can still use the full power of SQL to create optimized queries and even special features that a particular SQL engine provides.

    One of its killer features is the ability to create custom filter queries based on whether parameters are defined, so you can create one complex query which is relaxed based on the parameters defined at runtime.

    Check out SQLBits, and let me know what you think. You can leave a comment in the discussion secion of this episode. I find it to be a great tool to help me generate SQL for Postgres and hope you will too.


    002 First look at Hapijs 2.0, the Node.js web framework from Walmart Labs Feb 01, 2014
    Show notes

    This is a review of the Hapi 2.0 functionality unveiled last Monday, Jan 27, 2014 at &yet. The event was live streamed so I was able to watch and take notes. Eran Hammer @eranhammer, a Walmart labs engineer and lead developer for Hapi shared a top to bottom feature discussion including the new changes for version 2. Eran’s Slides

    My goal with this podcast is to mention some of the key changes with Hapi 2 and how you would leverage them in your code.

    hapi-png

    This review and Eran’s presentation are done such that you do not need have a familiarity with Hapi to get value, new users should come away with some understanding of Hapi and how it can be useful for building robust web applications.

    1. Episode Info
    2. Episode Notes
      1. Background
      2. Routes, Caching, State
      3. Plugins
      4. Authorization
      5. Ops
      6. Postmile example app
    3. Major breaking changes
    4. Resources
    5. Summary

    Episode Info

    • Episode: CW 002
    • Published: February 1st, 2014
    • Tags: nodejs, hapijs
    • Duration: 21:46

    Episode Notes

    Background

    • show notes http://codewinds.com/podcast/002.html
    • I have a link to the original live stream, the content starts at about 24 minutes in, so the URL in the show notes jumps directly to that spot.
    • Hapi is the awesome open source web framework created by Walmart Labs.
    • The Hapi framework grew out of years of development first at Yahoo as Sled, later renamed Postmile, then at Walmart Labs.
    • Initially Eran tried to build on Express a popular web framework, but found issues with plugin order, undocumented dependencies, fragility with large team use.
    • Hapi was developed by Walmart Labs for their mobile division
    • Hapi is built as a scalable web framework that they could use to evolve their system over time.
    • Initiallly used to reverse proxy or pass through requests to their existing backend written in java or other languages.
    • Then decorate, batch, and begin to replace legacy code with new code in Node.js
    • It ran 100% of their mobile traffic starting with Black Friday and proved its stability running at about 1-2% cpu on 50 servers throughout the highest load. Lasagna graphs flatlines for cpu and memory use
    • Walmart starting to replace more of its legacy code with Hapi and even now part of walmart.com
    • Hapi has great REST API support as well as infrastructure for building web apps or even serving static content
    • Just configure the routes and you are ready, no extra plugins are necessary for the most common functionality
    • Liked that Eran provides some quick commentary about features and how they evolved
    • Hapi 2.0 isn’t a massive increase in new functionality, in fact it is more about taking out the cruft, eliminating the redundant ways to do things. Names that evolved over time, picking the best and cleaning up the others.
    • This strategy shows the wisdom and experience of its architect, to resi the urge to add features by first solidifying the base.

    Routes, Caching, State

    • Route handler(request, reply) signature changed
    • server.route({}), can keep routes in one place while config and handler in separate module. validation is configurable, state (cookies)
    • server.table() gives you the active routing table
    • Hapi is a configuration centric framework, set js properties, then it tries to stay out of your way.
    • Hapi is written so the meat of your web application can stay pure, you don’t have to deal with the HTTP mechanisms unless you need to for a special case. This leads to clean code which is more focused on your business logic and less on how to deliver via HTTP.
    • Helpers can abstract out functionality used in many places like looking up a user profile or users shopping cart
    • Caching is changed in 2.0, dropping support for full page caching. You can still configure the client cache headers and expiry but the team removed the page cache since they didn’t want to have a half baked solution, one that didn’t handle all the variety of use cases.
    • They still have great support for helper caching which is more straight forward.
    • Eran said they will possibly add page caching back in later or I’d expect there to be a basic plugin which provides a basic page cache solving the simple use cases.
    • Route prerequesites clean up async handling, can specify arrays for parallel followed by single tasks which are processed serially and any combintion.
    • handler.bind can be used to share state using object methods
    • reply().hold(), later calling send() when ready
    • Cookie ttl configuration can now be done in a central location cleaninpu up the route config
    • Exentensive cookie functionality - automatically encoding in base64 json or even using encryption, hashing, and expiration with Eran’s Iron container

    Plugins

    • Plugins are a cornerstone of Hapi. These differ from something like Express in that plugins are just groupings of server functionality that can be mixed together into servers. You can organize a feature’s functionality, its routes, its configuration, and dependencies. This lives like a normal node.js package and only needs a register method to use with Hapi. These can be developed, versioned separately, mixed in to the server.
    • Hapi ensures that once they are all registered that the routes are all valid and nothing conflicts, its a large team’s dream. Easy to test new veerions.
    • Plugins can do everything you can do with the server, add routes, helpers, etc.
    • plugin.composer or command line option to hapi allows you to build a server with simply a package.json and a config.json specifying plugins to use.
    • If you couple plugins along with Hapi’s Confidence module you can have one setup which can provide server config for all your various environments.
    • The Confidence module provides dynamic configs which can be used for server environments or even runtime use for A/B testing
    • Plugin cache is now scoped so its data won’t collide with other plugins

    Authorization

    • Authorization is now properly extracted into schemes and strategies, basic auth, hawk, etc. It is much easier to setup authentication and you have options to make authentication required and optional.
    • Hapi has defined life cycle extension points at which you can register to have your code called during request life cycle. For instance you could hook in at the beginning of the request, before auth, after auth, before response, etc.
    • These extensions can specify dependencies and whether they need to go before or after others.
    • One change to how the signature for these extensions is that they now have two params (request and reply) just like handlers. You can call the reply(null) to continue response unchanged. Website docs don’t reflect this yet, so look at the code or tests.
    • You can now do additional things for streamed responses in your extensions like set headers as well as peek into the packets being sent back

    Ops

    • New ops functionality
      • Can have server load and memory use logged for easy server health montioring
      • Configure max input size, timeouts for client and server
      • You can register tail methods which run after a response has been sent
      • server.inject allows you to use the hapi stack without going through the network stack, great for testing and even for production use if you need to call back in like with OAuth 2.0
      • There is now a simulate property for simulating connection close issues

    Postmile example app

    • github.com/hueniverse/postmile - large sample app which has been upgraded to Hapi 2.0. It is a collaborative list making tool using hapi 2.0 and Mongo.

    Major breaking changes

    • handler(request, reply), extensions have similar signature
    • methods that had many aliases are now simplified like server.route
    • page caching removed for now
    • route prerequisites now use arrays to designate parallel tasks, and you can mix serial and parallel
    • read up on the new auth configuration and mechanisms
    • https://github.com/spumko/hapi/issues/1178 - github issue with all the Hapi 2.0 breaking changes

    Resources

    • http://hapijs.com - main site, docs being added for 2.0
    • https://github.com/spumko/hapi - git repo for Hapi
    • https://github.com/spumko/hapi/issues/1178 - github issue with all the Hapi 2.0 breaking changes
    • https://github.com/spumko - extracted Hapi functionality for use with Hapi or separately
    • https://dl.dropboxusercontent.com/u/52139546/hapi%20yet%3F.pdf - hapi-yet-slides with lots of code examples which Eran Hammer used for his live stream
    • http://www.youtube.com/watch?v=B3u0XkbhleA&t=1461 Eran Hammer Hapi Yet (Hapi 2.0) live stream at &yet, link jumps directly to 24 min where talk starts
    • https://github.com/hueniverse/postmile Eran Hammer’s sizeable hapi example using many of the Hapi features. Postmile is a collaborative list making tool using hapi 2.0 and mongo.
    • https://github.com/poeticninja/hapi-ninja - Saul Maddox’s @poeticninja boilerplate Hapi server example Node.js, Hapi 2.0, Swig templates, Gulp task runner
    • Follow http://codewinds.com/ blog and podcast for continuing coverage

    Summary

    So in summary, Hapi 2.0 is a well thought out release which cleans up and solidifies the codebase while adding some key functionality that can be built on.

    With Walmart putting this framework through the paces and other companies following in its footsteps like the company I am consulting to MasterCard, this framework has evolved with clarity, performance, team usability, and has great deploy and ops support.

    Furthermore, Eran and his team have proved that Hapi can handle Black Friday load with ultimate grace, and this new version solidifies its position among Node web frameworks.

    So I encourage you to check out Hapi, and let me know what you think. Head over to codewinds.com and leave me a comment or send me a tweet.


    001 Daniel Shaw interview discussing The Node Firm's public Node.js training courses Sep 17, 2013
    Show notes

    I had the pleasure of interviewing Daniel Shaw (@dshaw), managing partner and CEO of The Node Firm to discuss their upcoming public Node.js training courses at Joyent and beyond.

    Daniel Shaw

    Episode Info

    • Episode: CW 001
    • Published: September 17th, 2013
    • Tags: nodejs
    • Duration: 23:59

    Episode Notes

    The Node Firm has been doing corporate training since 2011, but now is offering some public courses starting in October 2013.

    The Node Firm public training courses at Joyent in San Francisco, CA:

    • Oct 8-10, 2013 (Tue-Thur) - Node.js Core Foundations $3,225
    • Oct 22-24, 2013 (Tue-Thur) - Advanced Node.js Development $3,225 (early registration price $2,985 until Sep 24)
    • More coming to cities near you

    Discussed in the 24 minute interview:

    • Background on The Node Firm
    • Description of the two courses
      • Topics covered
      • Intended audience
      • Prerequisites
      • Instructors, maximum class size
      • Course style

    More information

    • http://thenodefirm.com/training - direct link to The Node Firm’s training information
    • Contact The Node Firm for additional questions

    Previous 1 2

    Related Podcasts

    Know How… (Video)

    1

    Know How… (Video) Education
    JavaScript Jabber

    2

    JavaScript Jabber Education
    Programming Throwdown

    3

    Programming Throwdown Software How-To
    Software Engineering Radio – the podcast for professional software developers

    4

    Software Engineering Radio – the podcast for professional software developers Software How-To
    The Changelog: Software Development, Open Source

    5

    The Changelog: Software Development, Open Source How To
    Coding Blocks

    6

    Coding Blocks Software How-To
    footer-logo

    Contact Us

    Toll Free: 844-670-7747

    Links

    • Home
    • Top Charts
    • Networks
    • Apps
    • Independents Podcasts
    • Podcast Advertising
    • Podcast News
    • Contact Us
    • About Us
    • Analytics & Insights

    Stay Connected

      Privacy, Terms of Use & Our Code of Ethics Protecting Content Creators Copyrights