Created
April 1, 2016 14:37
-
-
Save Dirrk/fe664c448435e472ffd10afa35925ebf to your computer and use it in GitHub Desktop.
Revisions
-
Dirrk created this gist
Apr 1, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ 'use strict'; /* npm install [email protected] node thisfile.js curl -XPOST http://localhost:4000/v1/lead/property */ var Hapi = require('hapi'); var server = new Hapi.Server(); var count = 0; server.connection({ port: 4000 }); server.route([ { method: 'POST', path: '/v1/lead/property', handler: function (request, reply) { count++; if (count % 2 === 0) { return reply({success: true}); } reply(new Error('Invalid count')); } } ]); server.start();