generated from ptpaterson/typescript-package-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.js
More file actions
35 lines (29 loc) · 710 Bytes
/
setup.js
File metadata and controls
35 lines (29 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const path = require('path')
require('dotenv').config({ path: path.join(__dirname, '../../.env.example') })
const { importSchema, makeSchema } = require('../../build/index')
const secret = process.env.FAUNADB_ADMIN_KEY
const endpoint = process.env.FAUNADB_ENDPOINT
const typeDefs = [
`
type User {
name: String!
}
type Query {
allUsers: [User!]!
}
`,
`
type Budget {
name: String!
owner: User! @relation
}
extend type User {
budget: Budget! @relation
}
`,
]
const schema = makeSchema(typeDefs)
console.log('\n*** SCHEMA ***')
console.log(schema)
console.log('\n*** RESULT ***')
importSchema(secret, schema, 'replace', endpoint).then((res) => console.log(res))