Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 在环回4中启用SSL_Node.js_Loopback - Fatal编程技术网

Node.js 在环回4中启用SSL

Node.js 在环回4中启用SSL,node.js,loopback,Node.js,Loopback,我尝试按原样修改文件application.ts中的代码 this.bootOptions = { controllers: { // Customize ControllerBooter Conventions here dirs: ['controllers'], extensions: ['.controller.js'], nested: true, }, rest: {

我尝试按原样修改文件application.ts中的代码

this.bootOptions = {
      controllers: {
        // Customize ControllerBooter Conventions here
        dirs: ['controllers'],
        extensions: ['.controller.js'],
        nested: true,
      },
      rest: {
        protocol: 'https',
        key: fs.readFileSync('./cert/my-site.com.key'),
        cert: fs.readFileSync('./cert/my-site.com.crt'),
      }
    };
我在访问控制器API时遇到问题
尝试使用nmap查看打开的端口和curl,但似乎没有任何内容可用作https

最终我找到了答案

SSL设置应按原样在index.ts中设置

export async function main(options: ApplicationConfig = {}) {

  const optionssl = {
    rest: {
      protocol: 'https',
      key: fs.readFileSync('./cert/my-site.com.key'),
      cert: fs.readFileSync('./cert/my-site.com.crt'),
    }
  };

  const app = new MyApplication(optionssl);
不应更改application.ts