Skip to main content

Posts

Showing posts with the label javascript

NestJS + Mongo + Typegoose

The current state of Mongo with NestJS ( and Node) . Currently you have 3 options to use Mongo with Node (and NestJS). 1)  NestJS + Mongoose  where maybe the best tutorial I have found is here  https://scotch.io/tutorials/building-a-modern-app-using-nestjs-mongodb-and-vuejs  the issue is that I hate the fact I had to write the schema definitions and the typescript interfaces. If you are fine with writing everything 2 times ones the Schema and ones the Document as Typescript Interface maybe this is the best way to go. 2)  NestJS  + TypeORM where you can actually use TypeORM with MongoDB, however I do not recomment this if you want to learn more I would ask you to write this blog post  https://medium.com/articode/typeorm-mongodb-review-8855903228b1 3)   NestJS  + Typegoose - basically what it does is it uses your domain objects to get the schema from them. And this is what this post is all about. There is a lot of documentation h...

JavaScript inheritance (object-oriented programming)

  There are many posts explaining what JavaScript inheritance is how it works, is it bad or good, how it is comparable with Java inheritance with millions of examples using third party apis or function to make inheritance look more like C#/C++/Java Inheritance. This post is just to show HOW inheritance looks without anything else except browser so next time when you need to find it you can open this post which explains everything you need. JavaScript uses so called prototype inheritance you don’t need to know more except it is different then a C#/C++/Java way of doing inheritance Define a class In JavaScript you can define class like this: function A(){     this.aMethod = function (){         alert("A method");     }     this.bMethod = function () {         alert( "B Method");     } } Yes, yes there ...