Last active
September 9, 2015 16:56
-
-
Save diverted247/2542e86ef26b1fd48de8 to your computer and use it in GitHub Desktop.
Simple Hapijs Server
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 characters
{ | |
"name": "simple_hapi", | |
"version": "1.0.0", | |
"description": "Use Hapi as a general purpose localhost web server", | |
"main": "server.js", | |
"author": "Ted Patrick <[email protected]> (http://tedpatrick.com/)", | |
"license": "BSD", | |
"dependencies": { | |
"hapi": "9.3.1" | |
} | |
} |
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 characters
var Hapi = require( 'hapi' ); | |
var server = new Hapi.Server(); | |
var port = process.env.PORT || 8888; | |
server.connection({ port: port }); | |
server.route({ | |
method: 'GET', | |
path: '/', | |
handler: function (request, reply) { | |
reply('Hapijs Server'); | |
} | |
}); | |
server.start( function(){ | |
console.log( 'Server address: http://localhost:' + port ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment