ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Firebase Ex
    Search: WebService WebService 2023. 1. 21. 11:57

     

     

    사전준비

    frontend를 위해 nodejs, vsc가 필요.

     

    프로젝트 생성

    https://console.firebase.google.com/

     

     

    생성 후 화면

     

    Authentication

     

     

     

    Database

     

    Storage

    Hosting

     

     

    프로젝트폴더

     

    Firebase용 프로젝트 폴더를 만든다

     

    firebase cli 설치

    npm install firebase-tools

     

     

    서비스 계정 연동

    .\node_modules\.bin\firebase login

    Firebase연동할 계정에 로그인 요구 화면 나타난다.

     

     

    Firebase를 위한 준비

     .\node_modules\.bin\firebase init

    선택한 내용

    Firestore: Configure security rules and indexes files for Firestore,
    Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys,
    Storage: Configure a security rules file for Cloud Storage.
    ? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to 
    confirm your choices. Firestore: Configure security rules and indexes files for Firestore, Hosting: Configure file
    s for Firebase Hosting and (optionally) set up GitHub Action deploys, Storage: Configure a security rules file for
     Cloud Storage
    
    === Project Setup
    
    First, let's associate this project directory with a Firebase project.
    You can create multiple project aliases by running firebase use --add, 
    but for now we'll just set up a default project.
    
    ? Please select an option: Use an existing project
    ? Select a default Firebase project for this directory: fbtest1-11 (FbTest1)
    i  Using project fbtest1-11 (FbTest1)
    
    === Firestore Setup
    
    Firestore Security Rules allow you to define how and when to allow
    requests. You can keep these rules in your project directory
    and publish them with firebase deploy.
    
    ? What file should be used for Firestore Rules? firestore.rules
    
    Firestore indexes allow you to perform complex queries while
    maintaining performance that scales with the size of the result
    set. You can keep index definitions in your project directory
    and publish them with firebase deploy.
    
    ? What file should be used for Firestore indexes? firestore.indexes.json
    
    === Hosting Setup
    
    Your public directory is the folder (relative to your project directory) that
    will contain Hosting assets to be uploaded with firebase deploy. If you
    have a build process for your assets, use your build's output directory.
    
    ? What do you want to use as your public directory? public
    ? Configure as a single-page app (rewrite all urls to /index.html)? No
    ? Set up automatic builds and deploys with GitHub? No
    +  Wrote public/404.html
    +  Wrote public/index.html
    
    === Storage Setup
    
    Firebase Storage Security Rules allow you to define how and when to allow
    uploads and downloads. You can keep these rules in your project directory
    and publish them with firebase deploy.
    
    ? What file should be used for Storage Rules? storage.rules
    +  Wrote storage.rules
    
    i  Writing configuration info to firebase.json...
    i  Writing project information to .firebaserc...
    i  Writing gitignore file to .gitignore...
    
    +  Firebase initialization complete!

     

     

    서비스 배포

    .\node_modules\.bin\firebase deploy
     .\node_modules\.bin\firebase deploy         
    
    === Deploying to 'fbtest1-11'...
    
    i  deploying storage, firestore, hosting
    i  firebase.storage: checking storage.rules for compilation errors...
    +  firebase.storage: rules file storage.rules compiled successfully
    i  firestore: reading indexes from firestore.indexes.json...
    i  cloud.firestore: checking firestore.rules for compilation errors...
    +  cloud.firestore: rules file firestore.rules compiled successfully
    i  storage: uploading rules storage.rules...
    +  firestore: deployed indexes in firestore.indexes.json successfully
    i  firestore: latest version of firestore.rules already up to date, skipping upload...
    i  hosting[fbtest1-11]: beginning deploy...
    i  hosting[fbtest1-11]: found 2 files in public
    +  hosting[fbtest1-11]: file upload complete
    +  storage: released rules storage.rules to firebase.storage
    +  firestore: released rules firestore.rules to cloud.firestore
    i  hosting[fbtest1-11]: finalizing version...
    +  hosting[fbtest1-11]: version finalized
    i  hosting[fbtest1-11]: releasing new version...
    +  hosting[fbtest1-11]: release complete
    
    +  Deploy complete!
    
    Project Console: https://console.firebase.google.com/project/fbtest1/overview
    Hosting URL: https://fbtest.web.app

     

    마지막에 자신만의 웹서비스 주소가 나온다.
    접속하면 기존 화면이 나타난다.

     

    개발 PC에서 테스트

    .\node_modules\.bin\firebase serve
     .\node_modules\.bin\firebase serve 
    
    === Serving from 'D:\Temp\Firebase1'...
    
    i  hosting[fbtest1-11]: Serving hosting files from: public
    +  hosting[fbtest1-11]: Local server: http://localhost:5000

     

    접속 가능한 주소

    http://localhost:5000/

     

     

    기타

    npm install firebase

     

     

    'WebService' 카테고리의 다른 글

    Web 개발 개요  (0) 2023.07.09
    Firebase firebaseConfig 적용  (0) 2023.01.23
    Firebase firebaseConfig(apiKey, authDomain, authDomain, messagingSenderId, appId) 얻기  (0) 2023.01.23
    Firebase - Backend application  (0) 2023.01.21
    url 구조  (0) 2023.01.20
    NginX (엔진엑스)  (0) 2023.01.12
    Jsp(Java Server Pages)  (0) 2023.01.11
    Servlet (Java Web Server)  (0) 2023.01.11

    댓글