How to import gql to create typedefs in apollo server v4?

How to import gql to create typedefs in apollo server v4?


0

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``;

1 Answer
1


3

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

import gql from 'graphql-tag';



Leave a Reply

Your email address will not be published. Required fields are marked *