Skip to content

Instantly share code, notes, and snippets.

@dupski
Created May 19, 2018 23:51
Show Gist options
  • Save dupski/c86828a98e3cd5f35760ca6f86fd39c2 to your computer and use it in GitHub Desktop.
Save dupski/c86828a98e3cd5f35760ca6f86fd39c2 to your computer and use it in GitHub Desktop.
Create a GraphQL API in 5 minutes - demo data
export async function createDemoData() {
const user1 = (
await modelManager.create(new User({
full_name: 'Russell Briggs',
email: 'russ@russellbriggs.co'
}))
).result;
const user2 = (
await modelManager.create(new User({
full_name: 'Lauren Smith',
email: 'lauren@smith.co.nz'
}))
).result;
await modelManager.create(new Post({
post_date: '2018-05-14',
body: 'This is a cool post created with RevJS',
user: user1
}));
await modelManager.create(new Post({
post_date: '2018-05-17',
body: 'Laurens First Post',
user: user2
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment