如何配置lite-server绑定特定接口

时间:2017-06-29 11:57:19

标签: node.js lite-server

我需要lite-server才能只监听localhost。如何使用npm运行我的Angular 2应用程序时配置它?

我尝试为package.json添加一个选项:

[1] > lite-server -b localhost
[1] 
[1] ** browser-sync config **
[1] { injectChanges: false,
[1]   files: [ './**/*.{html,htm,css,js}' ],
[1]   watchOptions: { ignored: 'node_modules' },
[1]   server: { baseDir: './', middleware: [ [Function], [Function] ] },
[1]   port: 56618 }

我尝试将“bind”选项添加到bs-config.json:

[1] > lite-server
[1] 
[1] ** browser-sync config **
[1] { injectChanges: false,
[1]   files: [ './**/*.{html,htm,css,js}' ],
[1]   watchOptions: { ignored: 'node_modules' },
[1]   server: { baseDir: './', middleware: [ [Function], [Function] ] },
[1]   port: 56618,
[1]   bind: 'localhost' }

在这两种情况下,端口都可用于所有接口。任何提示?

0 个答案:

没有答案