API不与nodejs https服务器一起使用

时间:2016-09-28 14:59:09

标签: node.js api http https

我无法点击我在nodejs https服务器上创建的API,而它们在http服务器上工作正常。

以下是我将nodejs更改为https

的代码
var fs = require('fs');
var https = require('https');
var app = express();
var privateKey  = fs.readFileSync('server.key', 'utf8');
var certificate = fs.readFileSync('server.crt', 'utf8');

var credentials = {key: privateKey, cert: certificate};

var httpsServer = https.createServer(credentials, app);

httpsServer.listen(8000);

修改 但当我在终端点击 curl -k -X GET https://myurlandport/profile/id 时,我正在正确回复

0 个答案:

没有答案