Things that we will be touching on this session
- React.js front end
- React Material Design
- Node.js & Express.js REST API
import * as faunadb from "faunadb"; | |
export const q = faunadb.query as any; | |
export const faunaClient = new faunadb.Client({ | |
domain: process.env.FAUNA_DOMAIN, | |
secret: process.env.FAUNA_SECRET as string, | |
}); |
import { createYoga, createSchema } from 'graphql-yoga' | |
import { faunaClient, q } from './db' | |
let stream: any = null; | |
const schema = createSchema({ | |
typeDefs: /* GraphQL */ ` | |
type Post { | |
id: ID! | |
title: String! |
export default class Client { | |
constructor(key) { | |
this.key = key; | |
this.url = `https://us-dev.db.faunadb.net/query/1`; | |
} | |
_getKey() { | |
return this.key; | |
} |
-- | |
-- PostgreSQL database dump | |
-- | |
-- Dumped from database version 11.2 | |
-- Dumped by pg_dump version 12.1 | |
SET statement_timeout = 0; | |
SET lock_timeout = 0; | |
SET idle_in_transaction_session_timeout = 0; |
[{"_id":{"$oid":"57506d62f57802807471dcd1"},"grades":[2,6,10,9,14],"name":"Morris Park Bake Shop","contact":{"phone":"365-555-0134","email":"morrisparkbakeshop@example.org","location":[-73.856077,40.848447]},"stars":4,"categories":["Italian","Polynesian","Coffee"]}, | |
{"_id":{"$oid":"57506d62f57802807471dcd2"},"grades":[2,11,12,12],"name":"Dj Reynolds Pub And Restaurant","contact":{"phone":"492-555-0119","email":"djreynoldspubandrestaurant@example.org","location":[-73.98513559999999,40.7676919]},"stars":2,"categories":["Pancakes","Californian","African"]}, | |
{"_id":{"$oid":"57506d62f57802807471dcd3"},"grades":[8,23,12,12],"name":"Wendy'S","contact":{"phone":"152-555-0146","email":"wendy's@example.net","location":[-73.961704,40.662942]},"stars":4,"categories":["Fruits","Greek","Chinese"]}, | |
{"_id":{"$oid":"57506d62f57802807471dcd4"},"grades":[5,7,12,12],"name":"Riviera Caterer","contact":{"phone":"887-555-0124","email":"rivieracaterer@example.com","location":[-73.98241999999999,40.579505]},"stars":5,"categories":[" |
{"_id":{"$oid":"57506d62f57802807471dcd1"},"grades":[2,6,10,9,14],"name":"Morris Park Bake Shop","contact":{"phone":"365-555-0134","email":"morrisparkbakeshop@example.org","location":[-73.856077,40.848447]},"stars":4,"categories":["Italian","Polynesian","Coffee"]} | |
{"_id":{"$oid":"57506d62f57802807471dcd2"},"grades":[2,11,12,12],"name":"Dj Reynolds Pub And Restaurant","contact":{"phone":"492-555-0119","email":"djreynoldspubandrestaurant@example.org","location":[-73.98513559999999,40.7676919]},"stars":2,"categories":["Pancakes","Californian","African"]} | |
{"_id":{"$oid":"57506d62f57802807471dcd3"},"grades":[8,23,12,12],"name":"Wendy'S","contact":{"phone":"152-555-0146","email":"wendy's@example.net","location":[-73.961704,40.662942]},"stars":4,"categories":["Fruits","Greek","Chinese"]} | |
{"_id":{"$oid":"57506d62f57802807471dcd4"},"grades":[5,7,12,12],"name":"Riviera Caterer","contact":{"phone":"887-555-0124","email":"rivieracaterer@example.com","location":[-73.98241999999999,40.579505]},"stars":5,"categories":["Japa |
const doubleEachElement = (arr) => { | |
return arr.map(element => element == 1 ? 2 : element * 2); | |
} | |
const squareEachElement = (arr) => { | |
return arr.map(element => element * element); | |
} | |
const printOriginalAndModify = (arr, fn) => { | |
console.log('☎️ original', arr); |
class Observable { | |
constructor() { | |
this.fnArray = []; | |
} | |
subscribe() {} | |
emit() {} | |
} |
// worker.js | |
const { Worker, workerData, isMainThread, parentPort } = require('worker_threads'); | |
if (isMainThread) { | |
const worker1 = new Worker(__filename, { workerData: 'Worker Data 1'}); | |
worker1.once('message', message => console.log(message)); | |
const worker2 = new Worker(__filename, { workerData: 'Worker Data 2' }); | |
worker2.once('message', message => console.log(message)); | |
} else { | |
parentPort.postMessage('I am ' + workerData); |