/**
    To Test:
    
        Run the server.
        Try various URLs like:
            http://localhost:8080/ // success
            http://localhost:8080/?username=test // success
            http://localhost:8080/admin?username=walmart&password=worldofwalmartlabs // success
            http://localhost:8080/admin?username=walmart // fail
            http://localhost:8080/users?email=vnguyen@walmart.com // success
            http://localhost:8080/users?email=@walmart.com // fail
            http://localhost:8080/config?choices=1&choices=2 // success
            http://localhost:8080/config?choices=1 // success
            http://localhost:8080/config // fail
*/

// Load modules

var Hapi = require('../../lib/hapi');
var Types = Hapi.Types;
var S = Types.String,
    N = Types.Number,
    A = Types.Array;


// Declare internals

var internals = {};


internals.main = function () {

    // Initialize process

    Hapi.Process.initialize();

    var config = {};

    // Create Hapi servers

    var http = new Hapi.Server.Server('0.0.0.0', 8080, config);

    // Set routes

    http.setRoutesDefaults({ authentication: 'none' });
    http.addRoutes([{ method: 'GET', path: '/', handler: internals.get, query: {username: S()} }]);
    http.addRoutes([{ method: 'GET', path: '/admin', handler: internals.get, query: {username: S().required().with('password'), password: S()} }]);
    http.addRoutes([{ method: 'GET', path: '/users', handler: internals.get, query: {email: S().email().required().min(18)} }]);
    http.addRoutes([{ method: 'GET', path: '/config', handler: internals.get, query: {choices: A().required()} }]);
    http.addRoutes([{ method: 'GET', path: '/test', handler: internals.get, query: {num: N().min(0)} }]);

    // Start Hapi servers

    http.start();

    // Finalize Hapi environment

    Hapi.Process.finalize();

    Hapi.Log.info('Hapi server started');
};


internals.get = function (request) {

    request.reply('Success!\n');
};

internals.main();

@@ -1186,16 +1186,26 @@
 th: '/',
+ config: %7B
  handler
@@ -1239,24 +1239,26 @@
 ername: S()%7D
+ %7D
  %7D%5D);%0A    ht
@@ -1303,16 +1303,26 @@
 /admin',
+ config: %7B
  handler
@@ -1403,16 +1403,18 @@
 rd: S()%7D
+ %7D
  %7D%5D);%0A  
@@ -1463,16 +1463,26 @@
 /users',
+ config: %7B
  handler
@@ -1544,16 +1544,18 @@
 min(18)%7D
+ %7D
  %7D%5D);%0A  
@@ -1605,16 +1605,26 @@
 config',
+ config: %7B
  handler
@@ -1648,16 +1648,17 @@
 query: %7B
+ 
 choices:
@@ -1672,16 +1672,19 @@
 quired()
+ %7D 
 %7D %7D%5D);%0A 
@@ -1733,16 +1733,26 @@
 '/test',
+ config: %7B
  handler
@@ -1792,16 +1792,18 @@
 .min(0)%7D
+ %7D
  %7D%5D);%0A%0A 

Fix example