전편 에러였던 이유는 graphql이 data의 shape을 미리 알고있어야 하기 떄문이다.
rest API는 URL의 집합체
graphql API는 많은 type들의 집합
-apollo server에 type을 설명해야된다.
server.js
import { ApolloServer, gql } from "apollo-server";
const typeDefs = gql`
type Query {
text: String
hello: String
}
`;
const server = new ApolloServer({ typeDefs });
server.listen().then(({ url }) => {
console.log(`Running on ${url}`);
});
에러가 없으면 Running on http://localhost:4000/ 문구가있다.
다음시간에 꼐속..