TIL 2018-05-31
오늘 배운 것
1. 아폴로 최신버전으로 변경? 실패
react-apollo를 ^2버전으로 업그레이드하자 apollo-client가 없다는 에러가 뜸. 그래서 yarn add apollo-client
실행.
apollo-client는 다음 dependencies를 가진다
All dependencies
@types/async\@2.0.49
@types/graphql\@0.12.6
@types/zen-observable@0.5
apollo-cache@1.1.9
apollo-client@2.3.2
apollo-link-dedup@1.0.9
apollo-link@1.2.2
apollo-utilities@1.0.13
zen-observable-ts@0.8.9
2. 아폴로 스타터 키트 사용
프로젝트 구조 :
.
├── packages # Yarn packages with application source code
│ ├── client # Front-end Yarn package
│ | └── src
│ │ ├── app # Common front-end application code
│ │ ├── modules # Front-end feature-modules, each module has:
│ │ │ # (components, containers, GraphQL queries, redux reducers)
│ │ ├── styles # Application-wide styles
│ │ ├── testHelpers # Test helper for front-end integration tests
│ │ └── index.tsx # Entry point to web front-end with hot code reload
│ ├── common # Yarn package with Common code, redux store and logging
│ ├── mobile # Mobile front-end Yarn package
│ | └── src
│ │ └── index.ts # Entry point to mobile front-end with live code reload
│ └── server # Back-end Yarn package
│ | └── src
│ │ ├── api # GraphQL API implementation
│ │ ├── database # Database migrations and seeds
│ │ │ └── migrations # Database migration scripts using Knex
│ │ │ └── seeds # Database seed scripts using Knex
│ │ ├── middleware # Graphiql, GraphQL express and SSR rendering
│ │ ├── modules # Back-end server feature-modules, each module has:
│ │ │ # (schema definition, resolvers, sql queries)
│ │ ├── sql # Knex connector
│ │ ├── testHelpers # Test helper for back-end integration tests
│ │ ├── server.js # GraphQL api server set up
│ │ └── index.ts # Entry point to back-end with hot code reload
└── tools # All build and cli related files
또 문제는, 난 데이터를 관리할 자신이 별로 없으므로 알아서 aws에다 데이터 관리까지 해주는 prisma를 되도록 쓰고싶은데, 현재 apollo-universial-start-kit는 prisma가 지원되지 않는다. 다행히도 진행중인 issue가 있으므로 완성되길 바라고 일단 만들 수 있는 부분을 만들까.
이상하게 집에서 똑같이 설치하다가 계속 오류나서 yarn과 node를 재설치했다. 근데 생각해보니 stable이 아니고 그냥 git clone으로 해서 master가 받아진게 원인일까. 그렇다고 해도 master 역시 웬만해서 깨지지 않아야 할 텐데.
Comments