본 포스트는 https://velopert.com/133 [Node.JS] 강좌 01편: 소개 | VELOPERT.LOG Node.js 가 뭐지? NodeJS 는 구글 크롬의 자바스크립트 엔진 (V8 Engine) 에 기반해 만들어진 서버 사이드 플랫폼입니다. 2009년에 Ryan Dahl에 의해 개발되었으며 현시점 (2016-02-07) 최신 버전은 v5.5.0 입니다 velopert.com velopert님 강좌를 필사하여 공부하기 위한 포스트입니다. NodeJS란? nodejs는 크롬의 javascript엔진(V8 engine)에 의해 만들어진 server side 플랫폼이다. 2009년에 ryan dehl에 의해 개발되었다. 사람들의 오해. nodejs는 웹서버가 아니다. node 자체로는 아무것..
정상적으로 npx create-react-app my-app을 실행했는데 폴더안에 src, public 폴더가 없고 에러로 template을 불러올 수 없다고 뜨고, A template was not provided. This is likely because you're using an outdated version of create-react-app. Please note that global installs of create-react-app are no longer supported 겨우겨우 public, src 폴더를 생성하니까 1부터 9번까지의 방법이 나오면서 webpack version때문에 yarn start를 할 수 없다고 뜬다. 이때 해결방법은 create-react-app과 관련된 모든..
populate를 쓰면 ObjectId만 있던 field에 실제 값이 포함되어야 하는데, .populate("something") 을 사용할 경우 오히려 something: [] 으로 표시되는 경우가 있다. 그리고 TypeError: ID cannot represent value: 식의 에러가 뜰것이다. 이때에는 mongoose schema를 잘못정해준 것이다. 예를 들면 questions이라는 property에 Question의 array를 참조하게 하고 싶다면 아래와 같이 선언하는게 아니라, questions: { type: [Schema.Types.ObjectId], ref: 'Question' } 이렇게 선언해야한다. questions: [{ type: Schema.Types.ObjectId, r..
Mutation 문구가 중복되었을떄 발생한다. 1. 1개의 파일에 Query, Mutation 문구가 있는경우 Post.js Post { .... } extend type Query { .... } extend type Mutation { .... } extend 문구를 사용해서 파일별로 Mutation, Query를 여러번 선언할 수 있다. 2. Mutation, Query 파일 따로만들기 Mutation.js type Mutation { addPost():Boolean! addUser():Boolean! .... } 이렇게 1개의 Mutation 문구에 여러개 타입의 함수들을 선언할 수도 있다. 3. 여러개 타입을 여러개 Mutation, Query에 선언 이 경우는 1개의 Mutation, Quer..
DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. mongoose를 사용할때 뜰 수 있는 경고문구 입니다. https://mongoosejs.com/docs/deprecations.html Mongoose v5.9.25: Deprecation Warnings Deprecation Warnings There are several deprecations in the MongoDB Node.js driver that Mongoose users should be aware of. Mongoose provides options to work around these deprecation warnings, but y..
Error: Query root type must be provided. 에러는 graphql 에서 root query가 없기 때문이다. 에러가 떴을시에 grapqhl 문구에는 아마도 사용자 정의 type과 type Mutation 만이 정의되어 있을 것이다. 이 경우는 필요한 type Query를 만들어주면 되나 굳이 Query가 필요없는 경우엔 type Query { dummy: String } 으로 무의미한 더미 쿼리를 만들어주어서 해결할 수 있다.
TypeError: Cannot set property 'subscriptionServerOptions' of undefined graphql-yoga 부분에서 에러가 날 것이다. const server = GraphQLServer({typeDefs, resolvers}); 이면 const server = new GraphQLServer({typeDefs, resolvers}); 로 수정해주자
SyntaxError: The requested module 'graphql-yoga' does not provide an export named 'GraphQLServer' graphql-yoga에 GraphQLServer 모듈이 없다고? 원래 있다. 이런경우에는 babel로 셋팅이 되어 있는지 확인하자.. npm install @babel/node @babel/core @babel/preset-env --save 를 해주고 .babelrc 파일에 { "persets": ["@babel/preset-env"] } 문구를 추가해주자.