-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (43 loc) · 1.46 KB
/
index.js
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
require("dotenv").config();
const express = require("express");
const { postgraphile, makePluginHook } = require("postgraphile");
const { default: PgPubsub } = require("@graphile/pg-pubsub");
const pluginHook = makePluginHook([PgPubsub]);
const app = express();
app.use(
postgraphile(
process.env.DATABASE_URL,
process.env.SCHEMA,
{
pluginHook,
subscriptions: true,
skipPlugins: [require("graphile-build").NodePlugin],
appendPlugins: [
require("./plugins/subscriptionPlugin"),
require("./plugins/wrapRegistrationPlugin"),
require("./plugins/chuckNorrisPlugin"),
require("postgraphile/plugins").TagsFilePlugin,
require("@graphile-contrib/pg-simplify-inflector"),
require("postgraphile-plugin-connection-filter"),
],
dynamicJson: true,
enableCors: true,
enableQueryBatching: true,
enhanceGraphiql: true,
extendedErrors: ["hint", "detail", "errcode"],
graphiql: process.env.NODE_ENV == "development",
ignoreIndexes: false,
ignoreRBAC: false,
jwtPgTypeIdentifier: "app_public.jwt_token",
jwtSecret: "SuperSecret!",
pgDefaultRole: "capi_anon",
legacyRelations: "omit",
setofFunctionsContainNulls: false,
showErrorStack: "json",
watchPg: process.env.NODE_ENV == "development",
allowExplain(req) {},
})
);
app.listen(process.env.PORT, () =>
console.log("Server listening on port " + process.env.PORT)
);