Javascript
Fastode Server Framework
· ☕ 2 min read
Fastode is an experimental boilerplate / framework based on Fastify. Why another boilerplate? Well, I just wanted to experiment with technologies to create MVP products. Although I have used NestJS, AdonisJS and friends before, those frameworks, while being great, bring their structure and overhead to any project. I wanted to check how difficult or easy it is to just start with a bunch of basic features and leave everything else to the project.

Use Packages Locally Without Publishing Them
· ☕ 2 min read
How can you use packages being developed locally in other projects - without publishing them to npm repository? NPM Packages Make Life Exciting NPM makes it really easy to create packages and reuse them across projects. I am not even talking about big, useful libraries like Vue, Loadash etc. - just the routine problems across our projects.

Refer Project Folder from NPM Package
· ☕ 1 min read
You can refer to other files/folders using a simple require or using basic node libraries. But, how can you do that with npm packages? The Problem When creating a bunch of Javascript files, here’s what you can do to refer other files - 1 const awe = require("../plugins/awesome.js"); This fetches awesome.

Fastify and its plugins are great
· ☕ 3 min read
I had been meaning to use more of Fastify for work, but only made that a reality recently. So far I have had a great experience on the server framework. What is Fastify? Fastify is a low-overhead server framework built on top of NodeJS. Fastify was started in late 2016 and jumped to v1.

npm run does nothing at Svelte startup
· ☕ 2 min read
I was getting back to Svelte for a small project and ran into a strange issue. npm run dev did not run the svelte app as expected - no output or errors. First I create a new project. 1 2 3 4 npx degit sveltejs/template awesome-project-1 cd awesome-project-1 npm i npm run dev And, I get greeted with nothing.

Asserts are not just for testing
· ☕ 2 min read
Assert is a general-purpose validator and should not be used in the context of testing alone. An assert in Javascript simply checks for truthy values and produces an error otherwise. We use it quite a bit in automated testing when checking for correctness of output for pre-defined inputs. We use asserts like so -

unknown vs. any in Typescript
· ☕ 1 min read
Why use unknown when we have any in Typescript? Type inferences are powerful and allows us to do magic when we don’t know types. 1 2 3 const i: any = 1; console.log(i); // 1 unknown seems to do the same thing. 1 2 let x: unknown = 1; console.

Interfaces as function types in Typescript
· ☕ 2 min read
Let’s get to know interfaces for functions - yes, that’s a thing. We have seen interfaces used as types and interfaces as array types. Since function is an object and interfaces are supported on other objects, they should be supported on functions also. Right? You betcha. What is this blog if we can’t write about all the stuff that no one care’s about?

Modules in Typescript
· ☕ 3 min read
It’s not the why, but more on what of ‘modules’. No Javascript is an island. It was an island about two decades back but Javascript has done some pretty good land reclaimation to form large continents now. So it goes without saying that these are not the days of writing Javascript or Typescript in <script> tag in a single HTML.

Extend interfaces in Typescript
· ☕ 2 min read
Interface an interface. If that doesn’t excite you, I don’t know what will. We have seen interfaces used as types before. But as our God Goop says - “abstract; (while && when) you can;”. So, we are here to know about interfaces for interfaces. Consider this simple example - 1 2 3 interface Borg { name: string; } Now, any class implementing the interface Borg will have a name attribute.

Interfaces for Arrays in Typescript
· ☕ 2 min read
What exactly are interfaces for arrays? Previously we have seen interfaces as types. Interfaces provide useful abstraction on class and can be useful in tricky situations with complex types. But, what about interfaces for array? It turns out interfaces can be as easily applied for array types as well. They are just super useful as interfaces that define complex types and make arrays type-safe - nothing more, nothing less.

Anonymous functions in Typescript
· ☕ 2 min read
Let’s talk anonymous functions and make them, well, “not anonymous”. Anonymous functions are just functions without names. If you have been following this blog, or have written some Javascript - you surely would have come across them. Anonymous functions are just function expressions. Let’s see a quick example. The following code block has a ‘named’ function.

Abstract classes in Typescript
· ☕ 2 min read
Why and how of using abstract classes in Typescript. We have seen a bit of classes and objects in Typescript previously. There was however a key aspect of object oriented programming missing there. Although we discussed inheriting classes, we never mentioned abstract classes. Sacrilege, that. On the other hand, anything goes for the daily blogging gobble-gobble.