Skip to main content

Posts

Showing posts from April, 2020

NestJS API Integration With GraphQL Using Schema First Approach

What Is GraphQL?: GraphQL is a query language for your API and a server-side runtime for executing queries by using a schema type system you defined for your data. Graphql is not tied to any specific programming language(like NestJS, Java, .NET, etc) or database or storage engine. How GraphQL Different From Rest API: GraphQL exposes a single endpoint. HTTP-POST is the only Http verb recommended by GraphQL. Client applications(consumers of GraphQL API) can give instructions to GraphQL API about the response data. Schema vs Code First Approach: Schema First Approach - GraphQL SDL (Schema definition language) is a new syntax language, which is independent of any programming language and also integrates with any programming language. But while integrating with any programming language GraphQL Schema needs to be mapped with objects or classes or interface of the specific programming language to build communication between GraphQL Schema and programming language. In Nest

.NET Core Distributed SQL Server Cache

Introduction: A caching that can be shared or consumed by the multiple apps servers can be called a Distributed Cache. Distributed Cache is an external service, which increases the performance and scalability of applications. The advantages of Distributed Cache are like: No effect on the cache server on an application crash. No need to use local memory. Consistency in serving cached data around multiple applications. In General, Distributed Cache can be achieved by using Redi's Cache, SQL Cache, Third Party Cache Libraries. Here we will learn about .NET Core Distributed SQL Server Cache. Create A .NET Core WebAPI Project: Create a sample .NET Core Web API application to test the Distributed Cache. You can use either Visual Studio 2019 or Visual Studio Code editor, here I'm using Visual Studio Code.  Click here to know basics steps to use Visual Studio Code for .NET Core applications .  SQL Table For Cache: To store the cache data we need a table. So .NET

NestJS Multiple MongoDB Databases Accessing Sample Code

Introduction: Most of the case's applications are going to communicate with more than one database. Here I'm going to walk through with sample NestJS application which communicates with multiple MongoDB's.  Click here to know more about NestJS API CRUD using MongoDB . MongoDB Atlas: MongoDB Atlas is a cloud database. It has all the options of creating a MongoDB instance like for Free MongoDB Instance(for learning), Paid MongoDB Instance(for production). To illustrate multiple MongoDB connections for sample application here I'm going to use this Cloud MongoDB Atlas. It is fairly minimal steps involved for created a Cloud MongoDB instance. Note: It is not mandatory to use the cloud based MongoDb database. You can use either locally installed instances like Mongo Shell, MongoDb Compass. Create Sample NestJS Application: NestJS provides CLI which helps to create a boilerplate templated application to getting started NestJS CLI command: np