How to wire SailsJS to BreezeJS - angularjs

I'm looking at using Sailsjs for server side processing and validation and angular on the client side. Apparently BreezeJS supports Odata and WebApi for its interaction with the datasource. I know that Sails provides a REST Api out of the box.
How would I go about setting up Sails to provide either OData or WebApi to connectivity for Breeze?
Also, is there any other well known way of connecting Sails to Angular that provides the ability to generate queries on the client side that then get executed on the server? (My use case is filtering large datasets and manipulating the result on the client before batch updating the datasource)
Thanks!

What database and/or ORM are you using? That affects the answer, because the OData query must be turned into the appropriate query for your ORM/database. One of the following might work for you:
The breeze.server.node repo includes an OData parser that turns OData URLs into expression trees. Then there are adapters that turn these expression trees into MongoDB queries or Sequelize queries. If you are using MongoDB or Sequelize, this might be what you need. You can write your own adapter for Waterline if none exists yet.
The breeze.js.labs repo includes breeze.ajaxrestinterceptor.js which converts Breeze's OData URLs into REST-style resource URLs. It only supports a subset of the possible URLs, and will need to be adapted to your own API conventions.
An upcoming Breeze release will offer an alternative to OData: an all-JSON query language, inspired by the MongoDB and Sequelize query languages. This will make it easier to write your own backend, and to support Sails/Waterline in the future.

Related

Using BreezeJs on NodeJs with SQL Server

I have a rather central module that performs deep copies and cascading deletes on BreezeJs object graphs. I want to move some of these operations server-side, but I'm not looking forward to maintaining separate JavaScript and C# versions of this code.
From what I can tell, BreezeJs can be used as an ORM/ORD for MongoDB on NodeJs, but can it be used on NodeJs directly connected to SQL Server so that I can reuse my JavaScript code?
The only other way I can envisage this is by having my NodeJs instance make requests to the /breeze/ endpoint on my ASP.NET Web API server.
The breeze-sequelize npm package lets you use Breeze with the Sequelize ORM, which supports MSSQL.
The docs for breeze-sequelize are a bit thin, but there are a couple of samples that use it.

Is there any restful api for postgresql?

Im trying to develop a web app using angularjs, restangular and postgresql, im using ubuntu and xampp for development. I found ArrestDB, a restful api for postgresql. In its documentation,
# Get all rows from the "customers" table where the "country" field matches "Australia" (LIKE)
GET http://api.example.com/customers/country/Australia/
https://github.com/alixaxel/ArrestDB
While in restangular documentation,
// Just ONE GET to /accounts/123/buildings/456
Restangular.one('accounts', 123).one('buildings', 456).get()
https://github.com/mgonto/restangular
Do you guys know a free RESTful api for postgresql that works well with restangular?
ArrestDB interprets api/{Table}/{Field}/{....} while Restangular interprets api/{table}/{id}/{relations table}. I also tried api/{table}/{id}/{relations table} in ArrestDB but I get error 404.
I also found Postgrest in github but its in haskel, and i'm not familiar with haskel.
Thanks...
Postgrest seems to be a very viable choice. There is no knowledge of Haskell required to interact with it.
I have used PostgREST and recommend it. It is written in Haskell but requires no knowledge of Haskell (in the same way that pg is written in C, but no knowledge of C is required to use it). The documentation at postgrest.com is quite helpful and I've been able to get up to speed with it quickly. Best practices are to run pgREST through a reverse proxy (Apache, Nginx, etc.) to control web authentication and authorization. PostgreSQL will enforce permissions GRANTed to the configured pgREST user (INSERT, UPDATE, DELETE, etc.) on the DB served up by pgREST. There are a number of access control options listed in the pgREST documentation for switching user roles as requests come in, so the access control is pretty flexible in accommodating different usage scenarios.
You can use Express.js and Node.js to create RESTful API for example. It works with PostgreSQL well. I am using it now for my application, so I have a PostgreSQL DB, back-end in Express.js with pg-promise and Node.js and front-end in AngularJS with Restangular.
You can try
this tutorial,
this guy has a quite good blog about building API and other useful things.

AngularJS + Rule Engine

Is there any way to integrate Rule Engine (or Rule Engine concept to apply Business Rules) with AngularJS application?
I have heard about Drools. Is there any API provided by Drools which can be used in Angular Project?
My requirement is any input given by the user should first go to match the applicable rules, then it should pass to the angular-controller. Is this possible?
Thanks in advance.!
You just need to write a REST (or other HTTP-based) service to wrap your Drools rules. That way a client-side JavaScript framework such as Angular JS can call your REST operations.
The following is an example of an Angular JS client-side application integrating with Drools on the server: https://github.com/gratiartis/qzr
Although I should warn you that it's a work in progress, so please don't complain about lack of features or documentation. :)
you can also try IBM ODM (Operational Decision Manager), available on-premise or in IBM Cloud Bluemix.
http://bluemixtips.blogspot.co.uk/2014/05/rules-on-bluemix.html
http://www.ibm.com/developerworks/cloud/library/cl-hotel-rules-app/index.html (NodeJS sample)
Cheers
--Yves
#ylecleach
For drools, there are two possibilities:
First solution, as mentioned by Steve, is to write your own REST service to wrap drools engine.
The other solution is to use Drools Camel Server, which provides REST interface out of the box.
In contrary to other drools' document, the document of Camel server is a bit too short.
You can use JavaScript client to talk to a decision-as-a-service platform. Which the business rule/decision server hosts all your related business rules and make them available as a REST API interface. Then you can execute, manage and monitor those business rules via REST API interface.

reports using ssrs from JIRA

I am looking for way to build reports using SSRS from JIRA if that is not possible I am okay moving the data from Jira to a SQL DB utilizing SSIS. I am new to Jira and REST API. Connecting directly to the Jira back end Database is not an option
The jira api currently only supports JSON. so your best bet is to either build a custom reporting services extension to handle JSON as a data source or create a webservice that passes through the json calls and converts the results to xml which SSRS will be able to handle.
while both of these sound difficult depending on your requirements may only take a few lines of C# code:
there also seem to be a few 3rd party options but I haven't tried them

backbone.js and the need of a back-end engine

reading this days about backbone.js (documentation, examples, etc), and as far as i have understood, this framework lets you code directly on the front-end, almost all the back-end engine, since you can structure a MVC architecture. You can create your data model, controllers, etc.
My question is: if you already have the MVC architecture built on the Front-End (engine), you just need a DataBase (SQL) in the cloud from where you can fetch or store data, why do you need a back-end engine (RoR3,Java,etc) to persist document data?
thanks in advance
You are confusing two different meanings of front end, the model in the backbone framework is not able to connect to a database directly, this model are designed to connect to an API (that would be your backend) that is connected to a database
Things you still need to do on the server:
authentication
authorization
data sanitation and filtering
Possiby
interact to third parties
business logic that involves modules other than UI
etc.
Front-End MVC frameworks (Backbone, Angular, etc) all rely on a backend service to provide the data that, say Backbone, would then use as its model.
You could have an entire MVC pattern on the backend that accepts requests and spits out some JSON for a frontend MVC framework to use.
If you just want a database without creating a server, I would recommend using Google FusionTables - but you need OAuth and maybe even ClientLogin (depending) on top of that.
Because as far as I know Backbone works with RESTful services and it needs a server to handle the requests:
get: to list data from the db
post: to add new stuff to the db
put: to update current data
delete: to remove data from the db.
.. and also perform all sorts of server related stuff if you like
For instance I'm using Restful server based on Code Igniter to handle that stuff. From there you can choose the DB you want to work with. I already tried using MySQL and MongoDB

Resources