GraphQL multi-part request spec outlines a specification for multipart form requests in GraphQL. Jayden Seric, the author of the spec, has also authored two libraries apollo-upload-client and apollo-upload-server which makes it effortless to integrate file uploads in Apollo Server.
GridFS is a simple file system abstraction on top of MongoDB. This facilitates storage of large files (beyond BSON document size limit) in mongo database.
This post outlines the minimal integration required to save the files uploaded through the GraphQL API to GridFS.
Continue reading Uploading files to MongoDB GridFS via Apollo powered GraphQL API
It is fairly straightforward to add a GraphQL API powered by Apollo Server to a Next.js application through a koa middleware.
The abbreviated snippet below summarizes the setup along with the libraries involved:
Continue reading Integrating Next.js, Apollo Server and Koa
One of the interesting aspects in Typescript is that it is easy to extract out individual types from composite types.
Continue reading Unwrapping composite types in Typescript
This post is intended to primarily benefit people coming from other, so called “modern” editors to Emacs. Emacs veterans are likely to find most of the tips here very elementary.
I have observed that many programmers habituated to newer editors have many implicit assumptions about editing workflows which simply don’t hold true within Emacs environment and this prevents them from being productive to the fullest extent.
This post primarily focusses on how getting familiar with the concept of
regions in Emacs can result in productive workflows. These concepts, coupled with a few extensions can enable much more pleasurable code-editing workflows not easily achievable in more prevalent “modern” editors.
Continue reading Getting productive with selection and navigation in Emacs
Usage of C# inspired
Most of the times we
await on promises (typically returned from async functions), however, it is relatively less well known that
await works on arbitrary thenables. By thenables we mean any object with a
then function member.
This post covers this usage, and explores some scenarios where it can be interesting.
React refs are generally considered an anti-pattern as their usage typically encourages patterns which go against declarative compositon and top down flow of data.
This post explores a somewhat uncommon use case where refs can be used to expose layout slots in parent components to nested components.
Continue reading Exposing slots in layout containers through shared refs in React
I like F# and believe the author has done an amazing job evolving a functional language on the dot net platform but there are simply too many design choices in F# geared around C# compatibility and limitations of CLR being an object oriented language that when you switch to a different compilation target, these language aspects begin to look like bizarre warts.
Continue reading Fable+F# vs ReasonML | Hacker News
While this post primarily compares Reason and TypeScript, much of what is outlined about TypeScript equally applies to flow as well.
Continue reading ReasonML vs TypeScript – First impressions
Typescript team has explicitly stated that they don’t intend to extend typescript’s static type checking to the runtime.
Typescript Design Goals lists the following in the section on Non-goals:
Add or rely on run-time type information in programs, or emit different code based on the results of the type system. Instead, encourage programming patterns that do not require run-time metadata.
However, this also implies that for cases when static typing cannot help us we need to separately write validators using a validation library (eg. Joi) which has to be kept in sync with the typescript types.
This post outlines an approach to eliminate this redundancy using the io-ts library by Giulio Canti. This approach has also been adopted by some other libraries like MobX State Tree.
Continue reading Typescript and validations at runtime boundaries
This post outlines a container based development workflow using Vagrant and Docker.
Many common docker tutorials (eg. the official node tutorial) suggest a workflow where projects source is copied onto the image, which is then built and run through docker. This approach is not really practical for clojure development as normal clojure programming leans heavily on rapid prototyping and REPL driven development.
The setup below utilizes Vagrant and docker volumes to setup a development environment which ensures reproducibility and container isolation while retaining the short feedback cycle which clojure developers take pride in.
Continue reading A Vagrant+Docker based workflow for clojure web development