Skip to main content

Posts

Showing posts from September, 2020

Steps To Setup PostgreSQL Database Using ElephantSql Cloud Service

PostgreSQL is made of an object-relational database management system. PostgreSQL is a free and opensource relational database. PostgreSQL database supports all features of the SQL database with more extended features. ElephantSQL is a hosting cloud service for the PostgreSQL database. ElephantSQL will manage administrative tasks of PostgreSQL such as installation, upgrades to the latest stable version, and backup handling. For more information ElephantSQL check docs ("https://www.elephantsql.com/docs/index.html"). ElephantSQL Create User Account: To consume the ElephantSQL cloud service let's create a user account for authentication. ElephantSQL Authentication Path: https://customer.elephantsql.com/login ElephantSQL provides multiple authentications like 'SAML Authentication', 'GitHub' and 'Google'. Use any of the login technique of your desire to create an account. Accept Agreements: After successful login, ElephantSQL shows 'Terms of S

A Sample On HttpClientFactory Using Typed Client Technique In .Net Core Application

In .Net Core, using HttpClientFacotory is the recommended way to consume the Rest API. The HttpClientFactory can be implemented using the following techniques. Using HttpRequestMessage Object Named Client Typed Client Typed Client: Typed Client technique is to implement or create a separate entity or class file per API domain. So all Http communication implementations are registered in a specific class per API domain. In this approach, each entity or class will be injected with 'System.Net.Http.HttpClient' object by the 'HttpClienFacotry'. So in this approach, we will not use 'HttpClientFactory' directly like we did for 'Named Client' and 'Using HttpRequestMessage Object' techniques. In simple words for consuming one third-party rest API need to create a specific class for it, if we have 'n' number of rest APIs to consume in our project then we need to create 'n' number of classes to implement the HttpClientFactory logic specific

Vuex State Management Sample

Vuex is a state management pattern or state management library. Vuex makes data management easy and more maintainable in the application. Vuex main target of integration with Vue.js library.  In simple words, Vuex is a data store that supplies or provide data to Vue components with much consistently, more efficiently by making code more simple. Transferring of data between the component can be done effectively using Vuex when comparing with the traditional way(Vue.js passing data by input parameters). Vuex pattern is similar to Redux, Flux existing libraries for state management. Vuex Core Building Blocks: Actions:  Actions are task performers which have the capabilities to do either synchronous or asynchronous operations. In Vuex actions are used to invoke the rest API's to fetch the data and then actions call mutations to change the store state. To invoke mutations actions use a command called 'commit'. This 'commit' command invokes appropriate mutation and receiv

A Sample On HttpClientFactory Implementation Using Named Clients Technique In .Net Core Application

An Overview On Named Clients: In HttpClientFactory, the Named Clients technique is useful when an application has a requirement to consume multiple external API's. In the Named Client approach HttpClienFactory produces the HttpClient object specific to the domain. So if our requirement to consume multiple external domains then HttpClientFactory generates HttpClient object per domain based on their registration in a startup.cs file. So each external API domain needs to be registered in the startup.cs file with a specific 'Name' to that HttpClient. This name will be passed to HttpClientFactory to produce a HttpClient object with the specified configuration in the startup.cs file Here we have a configuration object to set time out for the expiration of the HttpClient object. Click here to learn more about an overview of HttpClientFactory Basic Implementation Sample On HttpClientFactory Using HttpRequestMessage Object Test 3rd Party API's: So to understand and implement a s

.Net Core Sample Example On HttpClientFactory Basic Implementation With HttpRequestMessage Object.

In this article, we are going to see the HTTP client factory's basic implementation technique to consume an API in our .Net Core application.  Click here to understand how HttpClientFactory works. Create A Sample API Project: Now let's create a .net core web API sample project in which we are going to consume another API(Third-party API) using HttpClientFactory. You can create your sample project using editors like Visual Studio 2019 or  Visual Studio Code . Test API To Consume: Let's consume a free Rest API to consume for our leaning process. There a lot of free developer API for learning purposes. Here we are going to use JSONPlaceholder. JSONPlaceholder: Guide :- https://jsonplaceholder.typicode.com/guide.html Endpoints:- 1.https://jsonplaceholder.typicode.com/users/1/todos (Todos endpoint) 2.https://jsonplaceholder.typicode.com/users/1/albums (Albums endpoint) 3.https://jsonplaceholder.typicode.com/albums/1/photos (Photos endpoint) 4.https://jsonplaceholder.typicode.