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``;
With Apollo v4 you should now import qgl
from the graphql-tag package.
import gql from 'graphql-tag';
Update: if you are using codegen with TypeScript then do:
import { gql } from '../__generated__';