简体   繁体   English

使用Hapi.js创建服务器

[英]Creating a server with Hapi.js

I'm going through a tutorial on Hapi.js. 我正在阅读有关Hapi.js的教程。 In the code below, 在下面的代码中,

// Start the server
server.start((err) => {

if (err) {
    throw err;
}
console.log('Server running at:', server.info.uri);
});

What is the syntax used in (err) => . (err) =>使用的语法是什么? Is it a function declaration? 它是函数声明吗? I can't find this operator in Javascript syntax anywhere. 我在任何地方都找不到Javascript语法中的此运算符。 Appreciate any clarification. 赞赏任何澄清。 Thanks. 谢谢。

That is the arrow function expression. 那就是箭头函数表达式。 You can read about it here https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions 您可以在这里阅读有关内容https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM