- Firebase 기능과 HTTPS 요청에 의해 트리거되는 이벤트에 응답하여 백엔드 코드를 자동으로 실행할 수 있는 서버리스 프레임워크.
- js 또는 ts 코드는 google cloud service에 저장되고 관리형 환경에서 실행
장점: 자체 서버를 관리하고 크기를 확장할 필요 없음
예시코드)
Firebase Cloud Functions에서 Firestore의 'users' 컬렉션에 문서가 생성 또는 업데이트 될 때, 'userWrittenWithNotificationHandler' 함수를 실행하도록 하는 Firebase Cloud Firestore 트리거
// 코드 예시
import { userWrittenWithNotificationHandler } from './notification/user-written'; // export 되는 function이 있는 위치
import * as functions from 'firebase-functions';
const func = functions.region('asia-northeast1'); // 일본 지역을 의미
export const userWrittenWithNotification = func.firestore.document('users/{userId}')
.onWrite(userWrittenWithNotificationHandler); // onWrite 메서드를 사용하여 문서가 생성 또는 업데이트될 때 실행되는 함수를 정의.
'Angular.js' 카테고리의 다른 글
@capacitor/filesystem, jsPDF 이용시, 앱에서 pdf 생성 안되는 오류 (1) | 2024.04.01 |
---|---|
[Angular.js] kakao map에 원하는 위치 마커 표시하기 (1) | 2024.02.20 |
전체적으로 사용되는 shared [뒤로가기] 버튼 제작 (0) | 2023.09.14 |
옵저버블을 promise로 변환하고 boolean 형태의 값 출력 (0) | 2023.06.13 |
Angular Guard에 대하여 (2) | 2023.05.30 |
댓글