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 { sum, subtract } = require('../math'); // const sum = (a, b) => a - b; const subtract = (a, b) => a - b; | |
// sum is intentionally wrong to check if error handling is done according to our assertion function | |
let result, expected; | |
result = sum(3, 7); | |
expected = 10; | |
expect(result).toBe(expected); | |
result = subtract(7, 3); |
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
// Will create a middleware called logger | |
// middleware is a called function requiring inputs of (req,res,next) that runs with every http request (if global app middleware) | |
// next MUST be called to continue on with the http request | |
const logger = (req,res,next) => { | |
req.hello = 'Hello World'; | |
console.log('Middleware ran'); | |
next(); | |
}; |
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
CREATE DATABASE perntodo; | |
CREATE TABLE todo( | |
todo_id SERIAL PRIMARY KEY, | |
description VARCHAR(255) | |
); |
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
// set static folder pointing to built client app | |
app.use(express.static('client/build')); |
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 Head from 'next/head'; | |
import Navbar from './Navbar'; | |
const Layout = ({ children }) => { | |
return ( | |
<div> | |
<Head> |
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 '../styles/global.css'; | |
export default function App({ Component, pageProps }) { | |
return <Component {...pageProps} />; | |
} |
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
.heading2Xl { | |
font-size: 2.5rem; | |
line-height: 1.2; | |
font-weight: 800; | |
letter-spacing: -0.05rem; | |
margin: 1rem 0; | |
} | |
.headingXl { | |
font-size: 2rem; |
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 '../styles/global.css'; | |
export default function App({ Component, pageProps }) { | |
return <Component {...pageProps} />; | |
} |
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
# list all commits made across different branches on the repo | |
git log | |
# list all branches (will also show which branch you are currently on) | |
git branch | |
# switch to a branch | |
git checkout <existing_branch_name> | |
# create new branch |
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 users = [ | |
{ name: 'mario', premium: true }, | |
{ name: 'luigi', premium: false }, | |
{ name: 'yoshi', premium: true }, | |
{ name: 'toad', premium: true }, | |
{ name: 'peach', premium: false }, | |
]; | |
export const getPremUsers = (users) => { | |
return users.filter((user) => { |