如何获得BreezeJS交谈MySQL数据库与角+节点? [英] How to get BreezeJS to talk to MySQL DB with Angular + Node?

查看:213
本文介绍了如何获得BreezeJS交谈MySQL数据库与角+节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

堆栈:MYSQL +防爆preSS +角+节点和节点的mysql交谈的DB

Stack: MySQL + Express + Angular + Node and node-mysql to talk to the DB.

编辑:我接法到本地数据库和连接工程。我不能让微风与之通信。

I'm connectiong to a local DB and the connection works. I can't get Breeze to communicate with it.

我试图让微风的Todo应用程序与此设置工作,但我得到一个本地主机:3000 /待办事项? 404(未找到),当微风走出来获取数据

I'm trying to get the Breeze Todo app to work with this setup but I'm getting a localhost:3000/ToDos? 404 (Not Found) when Breeze goes out to get the data.

我需要创建微风交谈的API?我试过这样:

Do I need to create the API for Breeze to talk to? I've tried this:

angular.module('mysql', ['ngResource']).
factory('ToDos', function($resource) {
    var ToDos = $resource('/ToDos', {}, {update:{method:'PUT'}});

    return ToDos
});

然后将其注入DataContext的服务在这里:

And then injecting it into the datacontext service here:

angular.module('mainApp').factory('datacontext', 
['$http', 'logger', 'breeze', 'ToDos', datacontext]);

function datacontext($http, logger) {

    var dataService = new breeze.DataService({
        serviceName: '/ToDos',
        hasServerMetadata: false
    });

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

我是pretty丢失什么,我做错了。任何帮助将是AP preciated。

I'm pretty lost as to what I'm doing wrong. Any help would be appreciated.

编辑:的意见告诉我,后端API需要创建。我的工作之上,但可以使用一些帮助转换微风的MongoDB 模块。

The comments informed me that the backend API needs to be created. I'm working on that but could use some help converting the breeze-mongodb module.

在repository.js有将呼叫微风的ZZA例如该模块的 MongoQuery() MongoSaveHandler()功能。难道是因为它们转化为MySQL作为简单的 connection.query ?而在转换的帮助将非常AP preciated!

In Breeze's zza example in repository.js there are calls to this module's MongoQuery() and MongoSaveHandler() functions. Would it be as simple as converting them to MySQL connection.query? And any help in the conversion would be much appreciated!

推荐答案

我对这个进度非常好奇。这是相当宏大。

I'm very curious about your progress on this. It's quite ambitious.

最后,我相信你会写东西像github\">的这将有一个查询和保存实施切合到MySQL。

Ultimately I believe you'll be writing something like the "breeze-mongodb" npm module which will have a query and save implementation attuned to MySQL.

这可能是没有一个ORM棘手。如果您选择的ORM进去节点为MySQL( 节点ORM ? ?),你可以学到很多关于什么从微风源$ C ​​$ C做 ContextProvider ContextProvider.EF ContextProvider.NH 中的breeze.net.server在github回购。你不必成为一个C#的人收集从code碱基转让的见解。

It could be tricky without an ORM. If you choose to go with an ORM in Node for MySQL (node-orm???), you can learn a lot about what to do from the Breeze source code for ContextProvider, ContextProvider.EF and ContextProvider.NH in the "breeze.net.server" repo on github. You don't have to be a C# person to glean transferable insights from that code base.

这篇关于如何获得BreezeJS交谈MySQL数据库与角+节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆