Build an Api Proxy Server

Api proxy A proxy is something sitting between the application and backend or some third party services. we can benifit from a proxy in many places Translate request formats Avoid expose the token, key etc. for the integration with some third party sevices Perform data transformation Build an Api proxy server Install packages npm i express dotenv cors needle npm i -D nodemon npm i express-rate-limit apicache proxy serice sample Implement a proxy call to https://api.

Connecting to MSSQL With Windows Authentication in Nodejs

Install npm package npm install mssql msnodesqlv8 --save Sample code const sql = require('mssql/msnodesqlv8'); var dbConfig = { connectionTimeout : 30000, database: "<DB Name>", server: "<server Name>", options: { trustedConnection: true, } }; var dbConfig2 = { connectionTimeout : 30000, connectionString: 'Driver={SQL Server Native Client 11.0};Server=<Server Name>;Database=<DB Name>;Trusted_Connection=yes;', options: { } }; (async () => { try { console.log("start"); await sql.connect(dbConfig); // both format of dbConfig or dbConfig2 will work const result = await sql.

Using JavaMail to Search GMail With IMAP

Enable IMAP in GMail Log into your GMail account and go to Settings Switch to tab “Forwarding and POP/IMAP” Select Enable IMAP Set Folder size limits to Limit IMAP folders to contain no more than this many messages 1,000 Less secure app access Go to Turn on Allow less secure apps if this is not turned on, we will get following exception javax.mail.AuthenticationFailedException: [AUTHENTICATIONFAILED] Invalid credentials (Failure) at com.

Retrieve and Export BitBucket server users

Sometimes, we wish to check if a BitBucket user has actually used his account or not. There is a post Query for inactive or idle users which has explained few different ways. I will try the API method. In this exercise, I try to achieve few things below with Python Send request to BitBucket server and get the list of users Convert the Unix timestamp to readable date time Export the user data to a csv file This is the sample code to get the information and export to csv file.

Simple Dependency Injection with dynamic finder at runtime

Sometimes, we have multiple methods to be called, but it has to be determined at run time, so try to make it less coupled and use reflection to achieve this. The sample scenario here is for Field Type. We have different implementation for each different field type, such as text, date etc., and at run time, a DoSomething method should be called based on the field type. Firstly, an interface is defined, which has methods called IsValid and DoSomething, IsValid method is used for a certain implementation which is valid for certain Fieldtype.

Accessing Jira with OAuth Authenticated request

Based on Jira OAuth authentication using DotNetAuth, we can successfully get the access token, and are able to make an authenticated request. Now we plan to use Atlassian.SDK to access Jira with oAuth authentication, but currently Atlassian.SDK only supports basic authentication. So we will need to inject little bit extra code to make this happen. Used packages Atlassian.SDK 8.5.0 RestSharp 105.2.3 DotNetAuth Current DotNetAuth 1.0.5 nuget package uses old RestSharp version, and it doesn’t work with RestSharp 105.

Jira OAuth authentication using DotNetAuth

In this post, we will try to connect to Jira with oAuth authentication in DotNet, I did some research, and mainly followed the instructions on Is there any JIRA OAuth implementation example in .NET and JIRA REST API Example – OAuth authentication Generate self-signed certificate OpenSSL is used for generating the certificate, openssl genrsa -des3 -out private.pem 2048 openssl rsa -in private.pem -outform PEM -pubout -out public.pem openssl pkcs8 -topk8 -nocrypt -in private.