node.js - Why this port number is not acceptable for my localhost server? -
i have hapi.js code below: ` 'use strict';
const hapi = require("hapi"); const server = new hapi.server(); server.connection({ host: 'localhost', port: 2922, }); server.route({ method: 'get', path: '/hello', handler: function (req, res) { res('hello world hapi.js'); } }); server.start((err) => { });
` problem when run server port number 22291 executes , exit without error, reason for? using linux centos 7
you need check error in start callback:
server.start((err) => { if (err) throw err; });
that give details need debug. make sure check errors in callbacks or you'll repeatedly run problem in node.
Comments
Post a Comment