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 pg from 'pg'; | |
import { ApolloServer } from 'apollo-server'; | |
import { makeSchemaAndPlugin } from 'postgraphile-apollo-server'; | |
export default async () => { | |
const pgPool = new pg.Pool({ | |
"user": "postgres", | |
"database": "postgres", | |
"password": "secret", | |
"host": "localhost" |
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
allAccounts | |
{ | |
nodes { | |
companyId: company | |
companyByCompany { | |
name | |
id | |
} | |
} | |
} |
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
{ | |
allAccounts(first: 10, offset: 20, condition:{ company: 1 }) | |
{ | |
nodes { | |
companyId: company | |
companyByCompany { | |
name | |
id | |
} | |
} |
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
async function rainSomeCatsAndDogs() { | |
const [dogs, cats] = await Promise.all([getDogs(), getCats()]); | |
await makeItRain(cats, dogs); | |
openAnimalProffUmbrella(); | |
} |
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
async function rainSomeCatsAndDogs() { | |
const [dogs, cats] = await Promise.all([getDogs(), getCats()]); | |
await makeItRain(cats, dogs); | |
await openAnimalProffUmbrella(); | |
} |
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
async function rainSomeCatsAndDogs() { | |
const dogsPromise = getDogs(); | |
const catsPromise = getCats(); | |
const [dogs, cats] = [await dogsPromise, await catsPromise]; | |
await makeItRain(cats, dogs); | |
await openAnimalProffUmbrella(); | |
} |
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
async function rainSomeCatsAndDogs() { | |
const [dogs, cats] = await Promise.all([getDogs(), getCats()]); | |
await makeItRain(cats, dogs); | |
await openAnimalProffUmbrella(); | |
} |
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
async function rainSomeCatsAndDogs() { | |
const dogs = await getDogs(); | |
const cats = await getCats(); | |
await makeItRain(cats, dogs); | |
await openAnimalProffUmbrella(); | |
} |
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
function rainSomeCatsAndDogs(){ | |
return Promise.all([getDogs(), getCats()]) | |
.then([dogs, cats] => makeItRain(cats, dogs)) | |
.then(openAnimalProffUmbrella); | |
} |
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
async function doStuff(){ | |
try { | |
return await rainSomeCatsAndDogs(); | |
} catch(someCatsAndDogs) { | |
// do something; | |
} | |
} |
NewerOlder