Home > Software design >  How to import gql to create typedefs in apollo server v4?
How to import gql to create typedefs in apollo server v4?

Time:11-21

In the version 3 of apollo server, we could use import {gql} from "apollo-server-express" to create typedefs and schemas. But in v4 of apollo server, apollo-server-express and apollo-server-core are depreciated and will be removed. So, instead of importing gql from apollo-server-express, how can we import gql

I tried import gql from new @apollo/server and it is not working either.

import { gql } from "@apollo/server";
const typeDefs = gql``;

CodePudding user response:

With Apollo v4 you should now import qgl from the graphql-tag package.

import gql from 'graphql-tag';
  • Related