Ad

Erro HTTPS Node JS_

All my requests using my https tools, but ta giving file reading error. If I have already had the error and solved you can pass as resolved? I gave chmod -R 777 permission to the directory but it still keeps giving me an error.

Follow test:

app.js 

var fs = require('fs');
var https = require('https');

//Local de arquivos ssl
var server_key = './home/admin/conf/web/ssl.chat';
var server_crt =./'home/admin/conf/web/ssl.chat.crt';
var server_pen ='./home/admin/conf/web/ssl.chat.pen';

var options = {
key: fs.readFileSync(server_key),
cert: fs.readFileSync(server_crt),
ca: fs.readFileSync(server_pen),
};
https.createServer(options, function (req, res) {
console.log(new Date()+' '+
req.connection.remoteAddress+' '+
req.method+' '+req.url);
res.writeHead(200);
res.end("hello world\n");
}).listen(4433);
--------------------Erro---------------------------------

$ node app.js
nternal/modules/cjs/loader.js:583
throw err;
^

Error: Cannot find module '/home/admin/web/chat/public_html/o'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Ad

Answer

Ad
source: stackoverflow.com
Ad