[install]
npm install firebase
[setup]
firebase.google.com
create a project
add a project
setup authentication
setup cloud firestore
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 React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import {Provider} from 'react-redux'; | |
| import {ConnectedRouter} from 'connected-react-router'; | |
| import * as serviceWorker from './serviceWorker'; | |
| import configureStore, {history} from './store'; | |
| import App from './App'; | |
| import { ThemeProvider } from '@mui/material'; | |
| import { darkTheme } from './themes/dark'; |
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 passport = require('passport'); | |
| const router = require('express').Router({mergeParams: true}); | |
| router.get('/', | |
| passport.authenticate('google',{ | |
| scope: ['profile'] | |
| }) | |
| ) | |
| router.get('/callback', |
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
| { | |
| "name": "mernstack", | |
| "version": "1.0.0", | |
| "description": "goalsetter", | |
| "main": "server.js", | |
| "scripts": { | |
| "start": "node backend/server.js", | |
| "server": "nodemon backend/server.js", | |
| "client": "npm start --prefix frontend", | |
| "dev": "concurrently \"npm run server\" \"npm run client\"" |
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
| require('dotenv').config(); | |
| var express = require('express'); | |
| var app = express(); | |
| var bodyParser = require("body-parser"); | |
| app.use(bodyParser.urlencoded({ extended: false })); | |
| app.use(bodyParser.json()); | |
| // Start server |
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 './App.css'; | |
| import {BrowserRouter as Router, Routes, Route, Navigate} from 'react-router-dom'; | |
| import Home from './pages/home/Home'; | |
| import { useContext } from 'react'; | |
| import { AuthContext } from './context/AuthContext'; | |
| import SignInUp from './pages/sign-in-up/SignInUp'; | |
| import SignUp from './pages/signup/SignUp'; | |
| // import Login from './pages/login/Login'; |
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
| // config/passport.js | |
| // load all the things we need | |
| var LocalStrategy = require('passport-local').Strategy; | |
| var mysql = require('mysql'); | |
| var connection = mysql.createConnection({ | |
| host : 'localhost', | |
| user : 'root', |
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
| <style> | |
| @font-face { | |
| font-family: Heydings; | |
| src: url(heydings_icons.ttf); | |
| } | |
| .icon { | |
| font-size: 3em; | |
| font-family: Heydings; | |
| } | |
| </style> |
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
| git switch --orphan <new branch> | |
| git commit --allow-empty -m "Initial commit on orphan branch" | |
| git push -u origin <new branch> |