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
| class BuildingBlock extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.handleClick = this.handleClick.bind(this); | |
| } | |
| handleClick() { | |
| console.log('click!'); | |
| } |
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
| class BuildingBlock extends React.Component { | |
| handleClick = () => { | |
| console.log('click!'); | |
| } | |
| render() { | |
| return ( | |
| <button onClick={this.handleClick}/> | |
| ); | |
| } |
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 express = require('express'); | |
| const passport = require('passport'); | |
| const bcrypt = require('bcrypt'); | |
| const jwt = require('jsonwebtoken'); | |
| const keys = require('../keys'); | |
| const UserModel = require('../models/user'); | |
| const router = express.Router(); | |
| router.post('/register', async (req, res) => { |
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 mongoose = require('mongoose'); | |
| const { Schema } = mongoose; | |
| const userSchema = new Schema({ | |
| username: { | |
| type: String, | |
| index: true, | |
| unique: true, | |
| dropDups: true, | |
| required: 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
| const passport = require('passport'); | |
| const LocalStrategy = require('passport-local').Strategy; | |
| const passportJWT = require('passport-jwt'); | |
| const JWTStrategy = passportJWT.Strategy; | |
| const bcrypt = require('bcrypt'); | |
| const { secret } = require('./keys'); | |
| const UserModel = require('./models/user'); |
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
| router.get('/protected', | |
| passport.authenticate('jwt', {session: false}), | |
| (req, res) => { | |
| const { user } = req; | |
| res.status(200).send({ user }); | |
| }); |
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
| :root { | |
| --red: #FF5A5F; | |
| --white: #FFFFFF; | |
| --lightgrey: #CDD1CC; | |
| --darkgrey: #555A5C; | |
| --darkergrey: #282C34; | |
| --gold: #FFB500; | |
| --turquoise: #007C80; | |
| --green: #55ffbb; | |
| } |
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 initialForm = { | |
| name: "name placeholder", | |
| title: "title placeholder", | |
| pets: [ | |
| { | |
| name: "Flow", | |
| funFact: "she can typecheck!", | |
| }, | |
| ], | |
| }; |
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
| type Person = {| | |
| +name: string, | |
| +spiritAnimal: string, | |
| |}; | |
| const tenXer = { name: "dirak", spiritAnimal: "Godzilla" }; | |
| const talk = (person: Person): void => { | |
| console.log(`Hi, I'm ${name}`); | |
| } |