1. init
yarn init
2. src/index.ts 생성
3. 설치
yarn add @babel/{node,cli,core} nodemon
4. package.json
"scripts": {
"dev": "nodemon --exec babel-node src/index.ts"
}
5. nodemon.json 파일 생성 (root에)
nodemon이 감시해야 할 파일의 확장자 지정
{
"ext": "js graphql"
}
6.
yarn add nexus
yarn add graphql
7. import 인식못해서
yarn add @babel/preset-env
.babelrc
{
"presets": ["@babel/preset-env"]
}
8.
yarn add ts-node -D
yarn add typescript
9. tsconfig.json
{
"compilerOptions": {
"lib": ["ES2016", "esnext.asynciterable", "DOM"],
"esModuleInterop": true // 이건 path 땜에
}
}
DOM을 추가해줘야 10의 에러가 안남
10. 에러
Cannot find name 'console'. Do you need to change your target library
-> tsconfig , lib property add "dom" 해야함.
11. 일단 서버부터 만들어보기
yarn add apollo-server
https://github.com/daheeahn/heart-signal-server/commit/f0910dac81440f0249f490c45518e7859ab74761
12. 이제 prisma init (이때 app.prisma.io 에 있어야 함)
create new db - mysql - prisma typescript client
docker-compose up -d
prisma deploy
prisma generate
아직 넥서스 잘 모르니까 하던대로 해보자
yarn add prisma-client-lib
prisma generate
Duplicate "graphql" modules cannot be used at the same time since different
에러
node_m , .lock삭제후 다시 깔기 (난 yarn 써서 package-lock.json 은 아예 삭제 함)
https://github.com/howtographql/react-apollo/issues/33
resolution로 버전 확정
그러면
prisma generate 는 잘된다.
https://github.com/daheeahn/heart-signal-server/commit/d052341a9104f2937b2f38fe3b497cd1bd810193
서버 세팅 완료 · daheeahn/heart-signal-server@d052341
github.com
'Study > GraphQL' 카테고리의 다른 글
[GraphQL] passport로 인증기능 만들기 (2) | 2020.03.23 |
---|---|
[GraphQL] apollo-server와 express 연결하기 (0) | 2020.03.22 |
[GraphQL / Apollo] 도입해보기 (0) | 2020.03.02 |
[GraphQL / Apollo] 오프라인 노트앱 만들기 (0) | 2020.02.16 |
Facebook도 쓰는 GraphQL 정복하기 (0) | 2019.12.04 |