Created
April 1, 2016 14:37
-
-
Save Dirrk/fe664c448435e472ffd10afa35925ebf to your computer and use it in GitHub Desktop.
This file contains 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 characters
'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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment