Node.js 在环回4中启用SSL
我尝试按原样修改文件application.ts中的代码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: {
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