Following up our previous post on generic types, we created a ServiceResponse<T>
type which had a statusCode: string
field to differentiate between the responses. In Typescript, a common pattern to differentiate between success and error is to create a union. In today’s post, we will see how we can leverage typegraphql to translate Typescript unions into graphql schema unions.
With the web transitioning to a decentralized internet, new systems and applications are being built. In order to access them, we need tools that interact with the next version of web, web 3.0. In today’s post, we will take a look at Metamask, a gateway to the decentrailized internet. We will look at what functionalities it provides and how to use it.
When doing web development, we often use JSON.stringify
to print to the screen the value of a variable. But when the variable contains multiple attributes, the print could be quite dense. To cater for that JSON.stringify
has extra parameters that can be specified. In today’s post, we will look at each of them with example.
Last week we looked at how to setup an Apollo server to serve graphql requests. We went through the setup by defining a TemplateStringArray
for the schema and defining functions in an object map for the resolvers. In this week post, we will look at how to simplify this two areas by leveraging Typescript features using typegraphql
package.
A data class is a class which is identified by the value stored in their attributes. The most common way of holding values in Python is via tuples. Data classes make is easier to construct a class with a name and meaning while keeping the value aspect in term of equality. In today’s post we will see how we can define data classes using the dataclass
decorator from the dataclasses
module.