Tracking the most important things that I need to get done during the week should be as easy as possible so that I can spend more time doing those things. The MuchToDo App will be a simple to do list tracker app.
Should the client or the server take more security precautions? Server.
What's the difference between local storage and session storage? Session storage is the same as local storage except that the data doesn't persist outside of the tab (session). The difference between local and session storage is that while local storage is always available in any tab and window of the same machine's browser, session storage isn't. Session storage is only available in the browser tab that the data was saved in, as soon as that tab is closed, the data is gone. As a result, session storage gives us an extra security feature for the frontend.
What problem does a JWT expiry time solve? JWT expiry time restricts the amount of time that an authorization token is valid for. This gives the server more control of the validity of any JWTs it creates instead of relying on the frontend client to ensure tokens aren't stolen.
Is a refresh endpoint protected or public?
How are the syntaxes async and await useful when writing JavaScript code?
The word “async” before a function means the function always returns a promise and wraps non-promises in it. The keyword await makes JavaScript wait until that promise settles and returns its result. Async Await makes execution sequential.
With respect to Knex, how does the transaction method relate to BEGIN and COMMIT syntax in PostgreSQL?
In PostgreSQL, BEGIN initiates a transaction block. All statements after a BEGIN command will be executed in a single transaction until an explicit COMMIT or ROLLBACK is given.
-- 1. How many people work in the Sales department? | |
SELECT | |
COUNT(e.id) | |
FROM | |
employee e | |
JOIN | |
department d | |
ON | |
e.department = d.id | |
WHERE |
const ShoppingListService = { | |
getAllItems(knex){ | |
return knex.select('*').from('shopping_list') | |
}, | |
insertItem(knex, newItem) { | |
return knex | |
.insert(newItem) | |
.into('shopping_list') | |
.returning('*') | |
.then(rows => { |
const knex = require('knex') | |
require('dotenv').config() | |
const knexInstance = knex({ | |
client: 'pg', | |
connection: process.env.DB_URL | |
}) | |
function searchByName(searchTerm) { | |
knexInstance |
DROP TYPE IF EXISTS grocery; | |
CREATE TYPE grocery AS ENUM ( | |
'Main', | |
'Snack', | |
'Lunch', | |
'Breakfast' | |
); | |
CREATE TABLE IF NOT EXISTS shopping_list ( | |
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, |
-- First, remove the table if it exists | |
drop table if exists bookmarks; | |
-- Create the table anew | |
create table bookmarks ( | |
id INTEGER primary key generated by default as identity, | |
title VARCHAR(50) not null, | |
URL VARCHAR(50) not null, | |
description VARCHAR(300), | |
rating INTEGER not null |
- Visit the YouTube API documentation discussed above and find the subscription list endpoint documentation. List 1 required parameter and 2 optional parameters for this endpoint. For each parameter listed, state the data type and give an example of the allowed values. https://developers.google.com/youtube/v3/docs/subscriptions/list Required parameter:
- part (data type: string, example value: snippet) Optional parameters:
- forChannelId (data type: string, example value: comma separated list of channel IDs)
- order (data type: string, example value: alphabetical)
- Visit the Google Maps Geocoding API documentation found here: https://developers.google.com/maps/documentation/geocoding/intro. Construct the full URL for requesting the geographic coordinates of The Statue of Liberty in JSON format. Do the same for your own address.