forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
55 lines (51 loc) · 1.16 KB
/
index.js
File metadata and controls
55 lines (51 loc) · 1.16 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import './src/env'
import { ensure } from 'arango-tools'
import { Server } from './src/server'
import { databaseOptions } from './database-options'
const {
PORT = 4000,
DB_PASS: rootPass,
DB_URL: url,
DB_NAME: databaseName,
DEPTH_LIMIT: maxDepth,
COST_LIMIT: complexityCost,
SCALAR_COST: scalarCost,
OBJECT_COST: objectCost,
LIST_FACTOR: listFactor,
TRACING_ENABLED: tracing,
} = process.env
;(async () => {
const { query, collections, transaction } = await ensure({
type: 'database',
name: databaseName,
url,
rootPassword: rootPass,
options: databaseOptions({ rootPass }),
})
const server = await Server({
arango: {
db: databaseName,
url,
as: {
username: 'root',
password: rootPass,
},
},
maxDepth,
complexityCost,
scalarCost,
objectCost,
listFactor,
tracing,
context: {
query,
collections,
transaction,
},
})
await server.listen(PORT, (err) => {
if (err) throw err
console.log(`🚀 Server ready at http://localhost:${PORT}/graphql`)
console.log(`🚀 Subscriptions ready at ws://localhost:${PORT}/graphql`)
})
})()