This file contains 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
// make sure to add express to package.json | |
var express = require('express'); | |
var app = express();; | |
var PORT = 3000; | |
app.get('/:id', function (req, res) { | |
console.log(req.params['id']); | |
res.send(); | |
}); | |
This file contains 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, { useContext } from 'react'; | |
import {AuthContext}from './firebaseAuthContext'; | |
import {Route,Redirect} from 'react-router-dom'; | |
export default function ProtectedRoute(props){ | |
const authValue=useContext(AuthContext) | |
if (authValue.userDataPresent){ | |
if(authValue.user==null){ | |
return(<Redirect to={props.redirectTo}></Redirect>) |
This file contains 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 Route = ({ children, href }) => { | |
var navObj = useContext(NavigationContext); | |
var copy={...navObj}; | |
switch(copy.pathname){ | |
case href : | |
return(children); | |
default: |