Last active
November 1, 2017 16:56
-
-
Save midnightcodr/c99884ea277d07973969b479e281e39f to your computer and use it in GitHub Desktop.
server.emit is not a function
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
async function main() { | |
const Hapi = require('./lib'); | |
const server = Hapi.server({ port: 80 }); | |
server.event('test'); | |
server.events.once('test', (update) => console.log(update)); | |
await server.emit('test', 'hello'); | |
await server.emit('test', 'hello'); // Ignored | |
} | |
main() | |
/* getting the following error | |
(node:41485) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: server.emit is not a function | |
(node:41485) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
node --version
v8.8.0