Angular2 App

时间:2016-08-18 19:53:37

标签: express angular https firebase

我在Angular2应用中创建了FirebaseService,如下所示:

@Injectable()
export class FirebaseService {

    public initialize(): void {    
        var config = {
            apiKey: "xxxxxxxxxxxxxxxx",
            authDomain: "xxxxxxxxxxxx",
            databaseURL: "https://xxxxxxxxxxxx",
            storageBucket: "xxxxxxxxxxxxxxxxx",
        };
        firebase.initializeApp(config);    
    }    
}

但是,当我尝试拨打initialize()时,我在浏览器控制台中收到以下错误。

VM438:1 Uncaught SecurityError: Blocked a frame with origin "https://xxxxxx" from accessing a frame with origin "http://localhost:3000".  The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.

这表明我需要从https服务器提供我的Angular应用程序。鉴于我是一名新手并使用Express在本地开发和提供我的Angular应用程序,这最好的方法是什么?

我是否需要去学习如何使用express设置https,或者我可以以某种方式解决这个问题并稍后回到我自学的https部分?

0 个答案:

没有答案