This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Transpile all code following this line with babel and use '@babel/preset-env' (aka ES6) preset. | |
require("@babel/register")({ | |
presets: ["@babel/preset-env"] | |
}); | |
// Import the rest of our application. | |
module.exports = require('./server.js') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firebase from "@firebase/app" | |
import "@firebase/auth" | |
import "@firebase/firestore" | |
import express from "express" | |
import * as Config from "./public/config.js" | |
// Initialize Firebase | |
firebase.default.initializeApp(Config.firebaseConfig) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const firebaseConfig = { | |
apiKey: "...", | |
authDomain: "...", | |
databaseURL: "...", | |
projectId: "...", | |
storageBucket: "...", | |
messagingSenderId: "...", | |
appId: "...", | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
<style> | |
.container, | |
.profile-section, | |
.login-section { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Config from "./config.js" | |
firebase.initializeApp(Config.firebaseConfig) | |
var provider = new firebase.auth.GoogleAuthProvider() | |
const loginButton = document.getElementById("login-button") | |
const logoutButton = document.getElementById("logout-button") | |
;(() => { | |
loginButton.style.display = "none" | |
logoutButton.style.display = "none" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"module": "commonjs", | |
"noImplicitReturns": true, | |
"noUnusedLocals": true, | |
"outDir": "lib", | |
"sourceMap": true, | |
"strict": true, | |
"target": "es2017", | |
"watch": true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as functions from "firebase-functions" | |
import * as admin from "firebase-admin" | |
const serviceAccount = require("./../service-account.json") | |
admin.initializeApp({ | |
credential: admin.credential.cert(serviceAccount), | |
databaseURL: "https://[project-id].firebaseio.com" | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<script src="https://www.gstatic.com/firebasejs/7.19.0/firebase-app.js"></script> | |
<script src="https://www.gstatic.com/firebasejs/7.19.0/firebase-firestore.js"></script> | |
<script> | |
// Your web app's Firebase configuration | |
var firebaseConfig = { | |
... | |
} | |
// Initialize Firebase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.collection("recipes") | |
.get() | |
.then((snapshot) => { | |
snapshot.forEach((element) => { | |
console.log(element.data()) | |
}) | |
}) | |
.catch((err) => console.log(err)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const now = new Date() | |
const recipe = { | |
name: form.recipe.value, | |
created_at: firebase.firestore.Timestamp.fromDate(now), | |
} | |
db.collection("recipes") | |
.add(recipe) | |
.then(() => { | |
console.log("recipe added") |