7
Next, I am learning Nodejs and I am delighted with the same, however I found my first stone on the way, access to relational database using some ORM (precisely to access Postgresql).
Initially I thought of using the Sequelizejs, even found the same well documented and promising, but I found his consultation a little complex.
a simple condition like this:
title LIKE 'Boat%' OR description LIKE '%boat%'
turns into:
$or: [
{
title: {
$like: 'Boat%'
}
},
{
description: {
$like: '%boat%'
}
}
]
}
So I decided to move on to the alternative, which would be the Edgejs. Then create a CLR Blibioteca in C# using Repository Pattern that accesses the data with Entity Framework, where all methods would have a signature similar to the following:
async Task<object> MethodName(object input);
And put in Nodejs, create only one module that would serve as a proxy for this Library.
As developer . NET, using the CLR Library seems easier to maintain, however I would like to have a broader view of what would be the pros and cons of this strategy. Is it a good option? or am I showing myself a lazy programmer?
He’s interested in issues I’m interested in, too. Let’s split. first some conceptual questions about programming languages, frameworks and Pis, for my part, then an attempt to answer, although perhaps more the level of pseudo-code. I’ve heard of Postgresql. It’s an architecture similar to Mongodb, right? I mean, an architecture, or Nosql-type programming language, right? then I’d never heard of Sequelizejs or Edgejs, but it’s right, I’m going to look more about these tools, and if possible even try to learn them.
– Tiago Morais Morgado
I’ve never worked with databases on Ode. Js, but I’m walking there. in the sense that I have been interested not only in angular and ruby Node in Rails, but also in mongodb and other nosql-like architectures. the code it shows is relatively simple. if your question is whether you can access postgre from Node, the answer is quite possibly yes, you have to create code in Node, and then map variables to access the postgresql database. in that way, I’m not quite sure, but also it won’t be difficult. Keep it simple. avoid putting frameworks by the middle to make i
– Tiago Morais Morgado
@Tiago, thanks for the interresis, Postgresql is a relational database, but it is evolving to be able to play the role of a non-structural database (Nosql). But the doubt itself was not about access to Nosql, until pq Node is great for this, but the traditional (relational) database. Sequelizejs is a Node ORM, just as Hibernate is for Java or Entity Framework is Dotnet. Edgejs is not a ORM, it allows a Node application to use an asyncronous CLR (C#) library, in which case it would use Edgejs to access a Repository written in C# (Entity).
– Tobias Mesquita