This tutorial is about setting up an API Gateway using Ocelot.NET and Consul. The consul integration for Ocelot.NET enables you to fetch registered services and load balance between multiple instances.
Completed Tutorial Source can be found on my GitHub
…
A quick tutorial about creating a CRUD RESTFul API in ASP.Net Core (.NET 5) using MongoDB.
Prerequisites
The entire solution can be found on my Github.
First, we’ll be deploying a local instance of MongoDB for development purposes. I’ll be using Docker Desktop for this.
In your terminal/command prompt type in the following command:
docker run --name mongodb -v /my/own/datadir:/data/db -p 27017:27017 --restart unless-stopped -d mongo
replace /my/own/datadir with a path on your computer…
5 amazing VSCode extensions that provide lots of quality of life improvements for VSCode. I personally use these extensions myself and I highly recommend them to anyone.
Indent-rainbow colorizes the indentation in front of your code. It’s a great visual tool that makes it a lot easier to see your indentation.
Another visual tool that colorizes your code brackets. I personally can’t live without this, especially when programming in JavaScript.
Here are a couple of amazing developer tools that will improve your efficiency and development capabilities.
Disclaimer
This is not a sponsored post, these are the tools I use in my own development workflow.
Insomnia Core is my preferred HTTP client for testing and calling REST APIs. It’s quite minimalistic and has lots of user-friendly options. It allows you to easily save requests and create different collections.
Figma is a great collaboration tool for designing applications, creating UX designs and wireframes. …
Enabling your secured AspNetCore Web API to accept Firebase tokens is quite simple actually. All you have to do is register the JWTBearer and add the firebase issuer information, detailed steps are below.
This tutorial assumes that you already have an AspNetCore API and a corresponding Frontend that uses Firebase for authentication.
services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.Authority = "https://securetoken.google.com/FIREBASE-APP-ID";
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidIssuer = "https://securetoken.google.com/FIREBASE-APP-ID",
ValidateAudience = true,
ValidAudience = "FIREBASE-APP-ID",
ValidateLifetime = true
};
});
Enable Authorization & Authentication in Startup.cs
app.UseAuthentication();
app.UseAuthorization();
An API Gateway is an application/service that is responsible for forwarding/redirecting requests to a downstream service. It is a common practice in Microservice Architectures, however, it also enables you to combine multiple REST APIs provided by different applications into a single HTTP(S) address.
Full Project can be found at https://github.com/dominiquekleeven/medium-apigateway-with-ocelot
If you’re using Visual Studio or Rider this should be quite…
First things first: I’d like to share this awesome git repository with lots of NuGet packages and other dotnet components.
FluentAssertions allow you to more naturally specify the expected assertion and outcome of a test case/unit test. I highly recommend this to anyone programming and testing in C#/.NET.
Code Example from the Fluent Assertions Documentation:
IEnumerable numbers = new[] { 1, 2, 3 };
numbers.Should().OnlyContain(n => n > 0);
numbers.Should().HaveCount(4, "because we thought we put four items in the collection");
AutoMapper basically enables you to easily convert domain objects to other domain objects based on their property names. I especially…
A quick and simple tutorial on hashing passwords using Bcrypt.
This requires the BCrypt.Net-Next NuGet package
https://www.nuget.org/packages/BCrypt.Net-Next/
Quick code example:
EncryptionHelper.cs (Example)
Quick code example:
A simple tutorial on how to create a quick RESTful API in .NET 5
This guide is for those who are quite new to ASP.NET Core development and have some knowledge about RESTful APIs and C# Development. The main goal of this guide is to quickly explain how to create a REST API and return some data.
Create a new project and choose the ASP.NET Core Web API
Short Coding Tutorials for .NET & NodeJS