πΎ μμΈ ν λμ€ ν΄λ½ μΉμ±
μ£Όλ³ ν λμ€μ₯ μ°ΎκΈ° & κ²μ€νΈ λͺ¨μ§ νλ«νΌ μΉμ± κ°λ°
Link : https://tennis9in.netlify.app
Github : https://github.com/protect-me/vue-tennis
Project Summary : https://velog.io/@protect-me/vue-tennis-summary
Development Log : https://velog.io/@protect-me/vue-tennis-log (Current
)
$ vue create vue-tennis
: vue-tennis
λΌλ μ΄λ¦μΌλ‘ vue νλ‘μ νΈ μμ±Vue CLI v4.5.13
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, Router, Vuex, Lint
er
? Choose a version of Vue.js that you want to start the project with 2.x
? Use history mode for router? (Requires proper server setup for index fallback in producti
on) Yes
? Pick a linter / formatter config: Basic
? Pick additional lint features: Lint on save
? Where do you prefer placing config for Babel, ESLint, etc.? In package.json
? Save this as a preset for future projects? No
$ cd vue-tennis
: κ²½λ‘ μ΄λ$ yarn serve
: μλ² μ€ν$ Control + C
: μλ² λ΄λ¦¬κΈ°editor(VScode)
λ₯Ό ν΄λΉ κ²½λ‘λ‘ λ€μ μ΄κΈ°$ vue add vuetify
(ν΄λΉ νλ‘μ νΈ λ΄λΆμμ λͺ
λ Ήμ΄ μ
λ ₯)
? Choose a preset: Configure (advanced)
? Use a pre-made template? (will replace App.vue and HelloWorld.vue) Yes
? Use custom theme? No
? Use custom properties (CSS variables)? No
? Select icon font Material Design Icons
? Use fonts as a dependency (for Electron or offline)? No
? Use a-la-carte components? Yes
? Select locale English
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
node_modules
- firebase κ΅¬κΈ λ‘κ·ΈμΈ
- νλ‘μ νΈ μΆκ°
asia-northeast3
(Seoul)</>
)$ Firebase login
$ Firebase init
firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
/Users/***/Documents/Develope/vue-tennis
? Which Firebase CLI features do you want to set up for this folder? Press Space to select
features, then Enter to confirm your choices. Database: Configure Firebase Realtime Databas
e and deploy rules, Firestore: Deploy rules and create indexes for Firestore, Functions: Co
nfigure and deploy Cloud Functions, Hosting: Configure and deploy Firebase Hosting sites, S
torage: Deploy Cloud Storage security rules
=== 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: vue-tennis (vue-tennis)
i Using project vue-tennis (vue-tennis)
=== Database Setup
i database: ensuring required API firebasedatabase.googleapis.com is enabled...
β database: required API firebasedatabase.googleapis.com is enabled
Firebase Realtime Database Security Rules allow you to define how your data should be
structured and when your data can be read from and written to.
? What file should be used for Realtime Database Security Rules? database.rules.json
β Database Rules for vue-tennis-default-rtdb have been written to database.rules.json.
Future modifications to database.rules.json will update Realtime Database Security Rules when you run
firebase deploy.
=== 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
=== Functions Setup
A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.
? What language would you like to use to write Cloud Functions? JavaScript
? Do you want to use ESLint to catch probable bugs and enforce style? No
β Wrote functions/package.json
β Wrote functions/index.js
β Wrote functions/.gitignore
? Do you want to install dependencies with npm now? Yes
> protobufjs@6.11.2 postinstall /Users/***/Documents/Develope/vue-tennis/functions/node_modules/protobufjs
> node scripts/postinstall
npm notice created a lockfile as package-lock.json. You should commit this file.
added 227 packages from 204 contributors and audited 227 packages in 6.657s
8 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
=== 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? dist
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? Set up automatic builds and deploys with GitHub? No
β Wrote dist/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
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
β Firebase initialization complete!
$ yarn add firebase@8.2.3
λ²μ λ³λ‘ importνλ λ°©μμ΄ λ€λ₯΄κ² λμμ κ½€λ νΌλμ€λ¬μ.
v8
λ‘ μ€μΉ μ, λ³Έ λΈλ‘κ·Έ κΈμ λ΄μ©κ³Ό κ°μ΄import
κ° κ°λ₯νλ,
v7
μ΄ν νΉμv9
μ΄μμμλ
import * as firebase from 'firebase/app'
κ³Ό κ°μ΄import
=> μμΈν μ¬νμ firebase Document μ°Έκ³
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import vuetify from './plugins/vuetify'
import './plugins/firebase.js' // plugin μ€μ
Vue.config.productionTip = false
new Vue({
router,
store,
vuetify,
render: (h) => h(App),
}).$mount('#app')
import Vue from 'vue'
import firebase from 'firebase/app'
import firebaseConfig from '../../firebaseConfig'
import 'firebase/auth'
import 'firebase/firebase-firestore'
firebase.initializeApp(firebaseConfig)
Vue.prototype.$firebase = firebase
<script>
(...)
mounted() {
console.log('here', this.$firebase)
},
(...)
$ npm install dotenv
.env
νμΌ μμ±firebaseConfig.js
μ λ΄μ©μ κΈ°μ
VUE_APP_apiKey=''
VUE_APP_authDomain=''
VUE_APP_databaseURL=''
VUE_APP_projectId=''
VUE_APP_storageBucket=''
VUE_APP_messagingSenderId=''
VUE_APP_appId=''
VUE_APP_measurementId=''
firebaseConfig.js
λ΄μ© μμ export default {
apiKey: process.env.VUE_APP_apiKey,
authDomain: process.env.VUE_APP_authDomain,
databaseURL: process.env.VUE_APP_databaseURL,
projectId: process.env.VUE_APP_projectId,
storageBucket: process.env.VUE_APP_storageBucket,
messagingSenderId: process.env.VUE_APP_messagingSenderId,
appId: process.env.VUE_APP_appId,
measurementId: process.env.VUE_APP_measurementId,
}
.env
New site from Git
> Github
> λ‘κ·ΈμΈ λ° κΆν μ€μ > ν΄λΉ repository
μ ν > κΈ°λ³Έ μ€μ μ μ§, Deploy site
site Settings
> Build & deploy
> Environment
> Environment variables
> .env
μ νκ²½λ³μ κΈ°μ
2. Functions bundling
11:16:27 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:16:27 PM: β
11:16:27 PM: Packaging Functions from functions directory:
11:16:27 PM: - index.js
11:16:27 PM: β
11:16:27 PM: β
11:16:27 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:16:27 PM: Dependencies installation error
11:16:27 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:16:27 PM: β
11:16:27 PM: Error message
11:16:27 PM: A Netlify Function is using "firebase-functions" but that dependency has not been installed yet.
μμ κ°μ μλ¬λ₯Ό λ§λ κ²½μ°
- μμΈ : Netlifyμ firebaseμ κ°κ°μ funtionsκ° μλλ°,
Netlifyκ° λ°°ν¬ν λ fireabaseμ funtions ν΄λλ₯Ό μ°Ύμλ€μ΄κ°μ ν¨μλ₯Ό μ°ΎκΈ° λλ¬Έμ μλ¬κ° λ°μ.- ν΄κ²° : μ΅μμ κ²½λ‘μ
netlify.toml
νμΌ μμ± ν μλμ κ°μ΄ μμ±[build] functions="NetlifyFunctions"
μ¦, Netlify λ°°ν¬ μ, netlifyμ funtionsλ NetlifyFunctions κ²½λ‘μ λ€μ΄κ°μ μ°Ύλλ‘ μ€μ ν¨.
λ¬Όλ‘ ν΄λκ° μκ±°λ λ§λ€λλΌλ λΉ ν΄λμ΄κΈ° λλ¬Έμ μλμ κ°μ logλ₯Ό λ¨κΈ°κ³ λμ΄κ° μ μμ
(μΆκ°λ‘ netlify funtionsλ₯Ό μμ±ν κ²½μ° μ μΈ)
The Netlify Functions setting targets a non-existing directory: NetlifyFunctions
μ ν리μΌμ΄μ
μΆκ° > μ± ν€ νμΈ
: REST API ν€
: JavaScript ν€
.env
νμΌμ λ΄μ© μΆκ°
VUE_APP_KAKAO_ADDRESS_REST_API_KEY=''
VUE_APP_KAKAO_MAP_JAVASCRIPT_KEY=''
: νλ«νΌ > web > Netlifyμμ λ°°ν¬ν μ£Όμ μΆκ°
Mixed Content: The page at 'https://tennis9in.netlify.app/Map' was loaded over HTTPS, but requested an insecure script 'http://dapi.kakao.com/v2/maps/sdk.js?autoload=false&appkey=*****'. This request has been blocked;
public > index.html > head
μλ λ΄μ© μΆκ°<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">