I took a formal Mongo course by Stephen Grider on Udemy. I am very happy with the way Stephen teaches. It is slow. Very relevant and practical. I feel accomplished and satisfied after the course. I prepared a few interview questions on Mongo and Mongoose which are quite useful.

  1. How do you create a model with Mongoose?
  2. What is the difference between an embedded document and an associated document?
Read More

ASP.NET Web API has an oAuth2 server. There is an endpoint, /token. Posting to the token endpoint with login credentials gives an access token. For authorising the user, pass the access token to all other endpoints exposed by the API.

Role based security restricts access to various parts of the API based on the user’s role. For example, there is more API access for admin users.…

Read More

HttpClient

The typical way to access a REST API is using the HttpClient. Create a HttpClient object. Pass in request headers. Call the PostAsync method with the URL and the request body. Use await keyword to wait for the response. Get the message as a JSON string. Use JavaScriptSerializer to convert the JSON to a C# object.

async Task<int> GetResultUsingHttpClient()
{
    Uri uri = new Uri("http://localhost/api/Algebra
                      /DoAlgebra?num1=3&num2=4");
Read More

ASP.NET Web API is the framework for creating HTTP services or RESTful services in the Microsoft platform. It super-cedes the WCF framework. Browsers in desktops, tablets or mobiles can access the Web API.

Comment API

In this post, we create a Web API for Comments. Create a new MVC application. Create a controller called CommentController. It is an API controller with CRUD methods and integrates with Entity Framework.…

Read More