I am quite new working with nodejs, I need to make a REST API that can work with websocket. I was searching for a framework that I could work with, I found actionhero.js, I think that can fit my needs.
But I see a little problem with this framework, that I can't find information about how can I make it work with oracle database, I will be really grateful if any of you can give me a light on how can I make it work this framework with a Oracle Database, or suggest me a framework based on REST API that can fit my needs.
Thank you.
Actionhero is, as you point out, a REST API framework. It doesn't include any database drivers (other than for redis, which it uses for cluster communication). You can easily ad support for any database you like in an initializer.
There are also plugins which add database support. For example, the ah-sequelize-plugin adds support for the Sequelize ORM, probably the most popular node.js ORM. Sequelize doesn't support the Oracle DB out of the box (very few things do), but there exist drivers you can use: https://github.com/adeo-proxideco/sequelize-oracle
Related
I have some node.js code that connects to CouchDB and now I'm exploring other NoSQL databases (DynamoDB, MongoDB, etc).
Is there a DB-agnostic module that would allow me to switch NoSQL databases without much trouble?
For sure you will need to change your code to adapt to a new database.
Anyways, there are a few options that allow you to switch from one of other database easily.
If you consider building from scratch, Loopback has a juggler that allows to setup each model to connect to a different database. If you want to include it as a module in your app. probably you are looking something like Waterline.
I have only used Loopback, it's great.
I haven't used Waterline.
Actually I'm planing to use NodeJS for web application development, my back-end DB is Informix, I'm looking for the ORM framework which best fit for Nodejs and also supports DB Transaction. Previously I used MyBatis with JAVA and Spring I'm wondering whether it supports or not.
Also it is very helpful if someone can provide an example/sample implementation fro CRUD operation using Informix, NodeJS (with or with out ORM)
I searched google with no luck. Appreciate your help. Thanks In advance
Here are some examples in multiple languages (java, javascript, python, etc) to help you get started with app development against Informix backend - https://github.com/ibm-informix/informix-client-examples
Web app development against Informix should be greatly simplified since REST APIs are available for accessing data in relational tables as well as collections. Here is a tutorial on the Informix REST APIs - http://www.slideshare.net/BrianHughes70/informix-rest-api-tutorial
Hey everyone I am working on nodeJS app. I searched some modules to manage my database (orientdb).
My question is: Why we use any ORM or ODM (or why is it recommenced), because there is a module which can provide many functions to manage DB.
I am still confused what should I use orientorm (https://github.com/mav-im/orientorm) or oriento (https://github.com/codemix/oriento)
Thank in advance..
Depending on the goal and depending on the ORM, ORMs have the advantage of adding support for:
schemas / models / collections: this makes it easier to create all classes/properties and, in some cases, migrations;
validations: make it easier to verify what gets saved in the DB.
All OrientDB ORM's I've seen for node.js expose Oriento, so that makes it easy to access the underlying oriento methods for doing more complex stuff.
Having said all this I recommend you try the waterline ORM with waterline-orientdb adapter. Waterline is an adapter based ORM with support for multiple databases (including support for associations between databases). Waterline-orientdb is the adapter for OrientDB which is based on Oriento. If at any point you need to use Oriento you can call .getDB() to access Oriento's instance.
Oriento is much more mature and supported. I suggest you to go with it.
I'm reviewing various frameworks for node.js and I'm just now testing Sails.js by writing a small CRUD app. I would like to know if there is an elegant way to use a different ORM other than the one sails includes.
I haven't seen anything in the documentation in Sails.js for using a different ORM. Are there any "integrated" non-orm specific features that I may be missing by attempting to use a different ORM?
Waterline should be considered a core part of sails. There isn't any easy way to replace it with a different ORM. In the google group for Sails.js, Mike McNeil (the creator of sails) acknowledges that Sails is not currently built to support swapping in a different ORM[1].
"[...]I'm totally open towards efforts to extend Sails to support other ORMs[...]"
[1] https://groups.google.com/d/msg/sailsjs/jmR36bD-Zys/-F0ZFy1Q1IoJ
In the upcoming v0.10 release of Sails the hooks and generators have been broken out and can easily be replaced to support whichever ORM you would like to use.
The community will be able to write ORM-loaders to replace the Waterline ORM loader and a generator to generate models in the correct format for the ORM of your choice. Custom blueprint controllers will also need to be written to talk to the ORM.
It's a lot of work but something that should start to happen once a stable v0.10 is released.
I wrote up the steps to consistently disable waterline throughout sails (v0.10, v0.9.8) here: https://stackoverflow.com/a/21612024/3263412
Without replacing the orm hook you definitely loose a big chunk of Sails' features, at least until the eco system particlebanana describes is developed:
pubsub
blueprints and rest routes (but could be worked around easily)
model scaffolding
custom adapters
On the other hand i figure it would not be too incredible hard to write up an orm hook for node-orm2 or sequelize plus the facades the other Sails hooks would probably need to work properly.
So i'm a bit conflicted. I want a quality driver/library to access that is also Schemaless, but it seems the only active MongoDB library for Nodejs is Mongoose.
Now, Mongoose is great and all, but again.. it's a Schema based library, and i don't want to use one with Mongo for this project.
So, the options i have found that fit my criteria (not Mongoose) are as follows..
Mongodb Native
Probably the most widely used option, and the foundation for other libraries, but not the most friendly. The deeply nested callbacks can quickly become ugly, im my opinion.
MongoSkin
This is a decent option, and it appears to allow a lot of access to normal Mongo constructs, but at the same time it is poorly documented and not all that active.
Mongolian
My personal preference.. but it lacks access to much of Mongo's constructs, and the project seems nearly dead.. It's basically had no activity in a year.
Mongojs
Likely the most recently active between the three wrappers, but it lacks GridFS support (that i see).
Are there any other options i am missing?
edit: Adding other libs to the list..
I'd recommend you look at either:
Directly using the native node.js library mongodb-native (upon which all these are based).
mongojs, which minimally wraps the native library to emulate the official mongodb API as much as possible.