Skip to main content

Posts

Showing posts from September, 2020

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 receives …

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 fileHere 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 HttpClientFactoryBasic Implementation Sample On HttpClientFactory Using HttpRequestMessage ObjectTest 3rd Party API's:So to understand and implement a sample on …

.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.com/user…