yes 선택 후 첫번째 호스팅 선택
use an existing project 선택
그리고
package.json에
에 추가한다.
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"predeploy": "npm run build",
"deploy": "firebase deploy"
},
Hosting url이 뜨면서 호스팅이 완료됨이 확인된다.
Hosting URL: https://nwitter-5aa7d.web.app
Nwitter
nwitter-5aa7d.web.app
규칙을 추가한다.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /tweets/{doc} {
allow read, create: if request.auth != null
allow delete, update: if request.auth.uid == resource.data.userId
}
}
}
스토리지에도 동일하게 규칙을 추가한다.
인증된 사용자만
파일을 읽고 write(create,delete,update) 할수 있음.
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null
}
}
}
스토리지의 경우 파일 사이즈도 제한이 가능하다.
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read: if request.auth != null
allow write: if request.auth != null && resource.size < 1*1024*1024
}
}
}
https://blog.naver.com/drv983/223262364309
파이어스토어 룰 설정, 스토리지 룰 설정
tweets 컬렉션의 읽기, 새로 트윗작성은 인증된 유저만 가능 https://firebase.google.com/docs/rules/basi...
blog.naver.com
'FRONTEND > React' 카테고리의 다른 글
[React-BookStore] 구현하고자 하는 기능 및 오류 수정 과정 정리 (0) | 2023.12.12 |
---|---|
[React-BookStore] firebase 인증 기능 추가하기 - 이메일/비밀번호 (회원가입/로그인) (1) | 2023.12.11 |
[Nwitter-Fire] 프로필 페이지 유저 아바타 / 프로필 업데이트/ 프로필 이름 수정 (1) | 2023.12.11 |
[Nwitter-Fire] 파이어 스토어 스토리지 사용설정 / 트윗 저장/이미지 저장 / 타임라인 생성 및 실시간 업데이트/ 트윗 삭제 (0) | 2023.12.08 |
[Nwitter-Fire] 새로운 깃허브 인증 추가 (0) | 2023.12.08 |