Posts

Showing posts from 2018

Adding Swagger UI with JWT Authentication in asp.net web api

Image
Introduction Swagger allows you to describe the structure of your APIs so that machines can read them. The ability of APIs to describe their own structure is the root of all awesomeness in Swagger. Why is it so great? Well, by reading your API’s structure, we can automatically build beautiful and interactive API documentation. We can also automatically generate client libraries for your API in many languages and explore other possibilities like automated testing.  Swagger does not only allows you to do API documentation but you can also authorize each endpoint in the swagger doc. In this tutorial, I use JWT to authenticate and pass the token to the "api_key" field which gives you access to protected resources. If you're not familiar with swagger, you should try checking out their website  http://swagger.io/ Adding Swagger UI with JWT Authentication in asp.net web API To authenticate your swagger using jwt tokens, you have to start by installing the swashbuckl...

Host multiple Website on one Amazon EC2 instance Using IIS

Image
Hosting multiple websites on IIS server Hosting multiple websites on Amazon Ec2 using IIS is simple, all you need to do is add a firewall inbound rule, edit the site binding in IIS, add a custom TCP rule in the ec2 security group to support the port you are going to be using. For example, you have two websites, one is the web app and the other is the Web API, and you need to use the same IIS server, the first thing to do is: 1) Add a custom TCP Rule in the ec2 dashboard under NETWORK & SECURITY tab 2) Open the RDP file and configure open IIS  and create the two websites. after creating the websites, you edit the binding for the two websites using port 81 on the API and port 80 on the web app. 3) Click on the start menu and type firewall, click on the windows firewall and advanced security, click the "Inbound Rule" and create a new rule. Select rule type "Port" and click next, specify port 81, allow connection from "public, ...

Nativescript-Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.

Image
Installing typescript and the SDK required, was a pain in the ass, but after spending days on the internet, I finally found a way to get it working. Before getting NativeScript to display the “No Issues Detected”, it was very difficult. The common problems people are facing is not being able to get NativeScript to find the SDK to user and also the right version. The issue: Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later. Run $ android to manage your Android SDK versions. You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system. Run $ android to manage the Android Support Repository After installing NativeScript and the required JDK and going through the documentation online, the error above was thrown. Solution I found out that NativeScript was looking at another folder in the “c:\users\USR \ AppData\Loc...

Difference Between Hangfire And MSMQ

Image
Hangfire or MSMQ Developers  are confused when it comes to making a decision whether to use Hangfire or MSMQ, what difference is MSMQ to Hangfire or are they really doing the same thing? Whether you decide to use Hangfire  or MSMQ or both for your applications, it would work. But there is a slight difference.   What is Hangfire Hangfire  is an open-source framework that helps to create,  process and manage your background jobs, i.e. operations you don't want to put in your  request processing pipeline: Mass notifications/newsletters Batch import from XML,CSV,JSON Building different graphs ... What is MSMQ Message Queuing (MSMQ) technology enables applications running at different times to communicate across heterogeneous networks and systems that may be temporarily offline. Applications send messages to queues and read messages from queues. Differences  Working with enterprise applications that require lot of persiste...

Simple Bitcoin Calculator

Image
Introduction Hello, it's crypto time!!! I am going to show you how to use Bitcoin exchange rates and currency conversion that supports all major currencies. I am currently using Coindesk which provides API to make data programmatically available to others.  To use the  API, you don't need to register, it is free! You can check out the supported currencies available on their website. To use the endpoint, you make a request to: https://api.coindesk.com/v1/bpi/currentprice/[code].json The code parameter accepts a valid ISO 4217 currency code  A sample request Take a look at the result, you would notice the rate and the rate_float object, which contains the exchange rate for the local currency to BTC. Below is a formula to convert BTC to your local currency. Formula = BTC Amount * Exchange Rate = Local currency Price Building the Bitcoin Calculator Using a client to consume the JSON data returned from ...