Created
February 21, 2016 16:43
-
-
Save vdeturckheim/9bb12b96421d0867dbe5 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'; | |
// Hapi framework | |
const Hapi = require('hapi'); | |
// our plugin in the file api.js | |
const ApiPlugin = require('./api'); | |
// We create a server object | |
const server = new Hapi.Server(); | |
// Server will listen on port 8080 | |
server.connection({ | |
port: 8080 | |
}); | |
// register the plugin | |
server.register(ApiPlugin) | |
// start the server | |
.then(() => server.start()) | |
// If th server is correctely started, we log it | |
.then(() => console.log(`Server running at: ${server.info.uri}`)) | |
// If something wrong happens, we log it | |
.catch(console.log); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment