角+微风+ mongoLab微风、mongoLab

2023-09-13 04:27:29 作者:热泪越沸腾.

我尝试在角使用plunkr与清风阿比MongoLab

I try to use breeze in Angular with MongoLab Api in plunkr.

var dataService = new breeze.DataService({
    serviceName: "https://api.mongolab.com/api/1/databases/webuniversite?apiKey=apikey",
    hasServerMetadata: false,

});

var manager = new breeze.EntityManager({ dataService: dataService });

我得到原产地 http://run.plnkr.co 不被允许访问控制允许-Origin。消息。

I get "Origin http://run.plnkr.co is not allowed by Access-Control-Allow-Origin. " message.

任何想法,使用MongoLab与Breezejs在一起。

Any idea for use of MongoLab together with Breezejs.

推荐答案

我们还没有准备好MongoDB的呢。几乎。很快。有一个在面向比特蒙戈 - code,但他们是隐藏的,而不是为你准备好使用。

We're not ready for MongoDb yet. Almost. Very soon. There is mongo-oriented code in the bits but they are "hidden" and not ready for you to use.

这是不是你真正的问题,但。你会得到这个错误谈论任何数据服务,因为您的数据请求是跨域(即数据服务器比其他位置的的 http://run.plnkr.co 的),除非服务器一起扮演的浏览器拦截跨域请求。我的意思是服务器支持 CORS (或 JSONP 的要求仅情景)。

That isn't your real problem though. You'd get that error talking to any data service because your data request is cross-origin (that is, to a data server at a location other than http://run.plnkr.co) and the browser blocks cross-origin requests unless the server plays along. By that I mean the server supports CORS (or JSONP for request only scenarios).

我们提供尊重CORS一个公共的服务器。目前,它提供了样本数据的Todo( http://sampleservice.breezejs.com/api/Todos/Todos )和罗斯文数据( http://sampleservice.breezejs.com/api/Northwind/employees )从SQL数据库。您可以在工作中看到它在的jsfiddle与淘汰赛(1),并在的 plunker具有角 。

We provide a public server that respects CORS. It currently delivers sample Todo data (http://sampleservice.breezejs.com/api/Todos/Todos) and Northwind data (http://sampleservice.breezejs.com/api/Northwind/employees) from SQL databases. You can see it at work in a jsFiddle with knockout (1) and in a plunker with angular.

没有MongoDB的,只是还没有。

Nothing for MongoDb just yet.

(1)计算器prevents我从给你一个链接的jsfiddle。傻了,保姆国家废话。所以,你必须从这个构造链接自己: http://jsfiddle.net/ +IdeaBlade / ExaFM /光/

(1) StackOverFlow prevents me from giving you a link to jsFiddle. Silly, "nanny state" nonsense. So you'll have to construct the link for yourself from this: http://jsfiddle.net/" + "IdeaBlade/ExaFM/light/"

发布节点/蒙戈支持和样品。见这太问题:What与前preSS和蒙戈DB?

Released Node/Mongo support and a sample. See this SO question: What is the state of BreezeJS integration with express and mongo DB?