What is GraphQL and why should I use it?

Why do I use GraphQL? Also, the case for not using GraphQL. You must have seen the previous post where I waxed eloquent about how I mess up my Rest APIs. There was no way I would be satisfied doing that to a single technology stack. Ergo, GraphQL. What is the need for GraphQL? Google GraphQL and refer docs- there are smarter people with better answers than me. But, since the Internet can be a scary place and I love to write about things that I am not an expert in - here’s a gist about what I think. ...

How not to design Rest services

How not to design Rest services? This is not a theoritical introduction to Rest - there’s something called the ‘Great Internet’ for that. But, what I do want to (cautiously) write about is how I mess up the design principles carefully laid out by smarter people. Practice 1: Use verbs in resource names We typically use the following API names - GET https://api.com/contact PATCH https://api.com/contact This is not a problem in the normal course of designing services. But, when it is time to get some complex queries - I always do a rain dance and come up with stupid names. ...

Hosting Models for Blazor

Blazor has three hosting models - as I see it :) Server Client Client++ We will look at them in brief below. Server Server hosted implies the entire application being hosted on server. A razor-thin (no pun) app is delivered to client and there on client relies on server for everything. I mean everything - All clicks, user input, gestures etc. will be transferred to server through a SignalR connection. Server figures out what to do Server does DOM diffing, keeps track of updates that are done client-side and what should be sent to client. Server delivers those changes to client over the ever-persistent SignalR Server sees any connection drops and maintains state if client reconnects Client reacts, and keeps reacting with help from server Can work on older browsers (though, to be frank, if you are using old browsers - you should be upgrading old browsers and the apps rather than reading this article) Though this may sound primitive, but works wonderfully well - provided you have good connectivity to server and a fast-enough server. ...

Format Hugo markdown and code

Format your markdown using prettier and you are off to the races. Hugo static site generator keeps everything simple. I just love the power of typing in something in markdown, and seeing the finished HTML pages and blog formatted to specs (in no time, I might add). I use VSCode for writing markdown text. This works out beautifully - I can save markdown files and prettier kicks in to format everything - the markdown within those files and the code within markdown. ...

Blazor for Production Anyone? Preview 7 is Released

Blazor is a big part of why I am looking forward to .NET 3.0. That’s one of the reasons I try to play around with the individual releases. Though Release 6 (I think ) caused some pain, the release schedules seem to be good as previews. As I understand - the ASP.NET Core team had been working on ironing out issues and making the application ready. That has come to a larger milestone since Release 7 has been out for a week and it is said to be ready for production. ...

Use MySQL Load Files Data in AdonisJS

Use MySQL load data function to load data from files within within AdonisJS services. You can perform batch data and file operations efficiently using database utilities. The logic will likely be quicker, lighter on resources, and overall, more suited for batch jobs. Loading data from files is not as sought-after as in the good-ol’ days, but is quite common in enterprise applications. One or more of the following operations may be required to load data from files - ...

Batch Operations in AdonisJS

Use Adonis Scheduler to create batch tasks as well as schedule execution of said tasks. Adonis Scheduler improves your efficiency in writing batch jobs. I am talking about bulk operations that may or may not be suitable for your general purpose service and controllers. Although scheduler’s purpose seems to be, well, scheduling stuff we can reuse Tasks enabled by scheduler to run bulk operations. Install Scheduler First, install scheduler - yarn add adonis-scheduler Let AdonisJS know that you have added scheduler - ...

Business layer vs. direct database operations

I have this annoying behaviour to force as many things as I can through the business layer. This can be a boon and bane at the same time. What do I mean by business layer? Let’s say I have an application running on AdonisJS. For every operation (CRUD) - I try to go through controllers/services Almost all of them through APIs when called from front-end Almost all of the operations through Lucid with exceptions through Database statements Use Tasks or equivalent for batches Everyone does this, why is it a point of discussion? Going through business layer is good. You can control what gets read or updated when routing through the server layers. ...

Blazor and what it means for web development

As a web developer I am amazed on web assembly and what Blazor could do with it. And, I am saying that even though I absolutely love what Javascript can do. The Back Story I had been hearing about this Microsoft experiment with web assembly (WASM) for quite sometime, but got an opportunity to take a further look starting late 2018. This was the time when news of Blazor being released as part of .NET Core started going rounds. At a later time this was expected to be server side Blazor. I can’t find the patience to go over the messaging confusion with Razor pages, Razor components, server-side and client-side Razor / Blazor. We will get back to that topic at some time. ...

Create a Websockets App in NestJS

NestJS is one of the things I have been playing around a bit in the recent days. Here’s how you can create a websocket application quickly on NestJS. Did I say this is a sample app that serves no real-world value other than poking around the application? Setup project in NestJS First.. install NextJS if you have not done so. yarn global add @nestjs/cli Create a new project. nest new websocket-proj Now, install support for sockets. ...