Node.js

TyoeORM vs Prisma to build GraphQL APIs with TypeScript

If you are building GraphQL APIs with TypeScript and have a relational database, there are two main ORM libraries we can use: Prisma and TypeORM. Both of them are similar. They both use models to define database tables, have query APIs, handle db connection well, have good documentations and community …

Node.js

Handling Authorisation With Apollo

There are many ways to handle authorisation with Apollo. Authorisation is the process to determine if the authenticated user has access rights for the particular resources while authentication is to confirm the user’s identity. In short, my recommendation is (5), by using graphql-shield. You can also check the code example …

Node.js

Node.js Libraries for Protecting GraphQL APIs

If you want to look beyond authentication and authorisation to protect your GraphQL APIs, there are a few Node.js libraries you can have a look at. 1. Implementing Rate-Limiting Protection Rate-limiting will prevent too many requests coming in at once. For this, you can start with looking at graphql-rate-limit-directive. It …

Node.js

How to fix the error: “Cannot use GraphQLSchema “[object GraphQLSchema]” from another module or realm.”

When I created a lambda function with Typescript and GraphQL support with the apollo-server-lambda module (see the repo here), I got the error. It took me a while to figure out how to fix it, but finally I did by adding a module to webpack. The solution for this issue …