sandbox-node/postgraphile/index.js

29 lines
735 B
JavaScript

require('dotenv').config();
const express = require("express");
const { postgraphile } = require("postgraphile");
const app = express();
const postgraphileOptions = {
watchPg: true,
dynamicJson: true,
setofFunctionsContainNulls: false,
ignoreRBAC: false,
showErrorStack: "json",
extendedErrors: ["hint", "detail", "errcode"],
exportGqlSchemaPath: "schema.graphql",
graphiql: true,
enhanceGraphiql: true,
allowExplain(_) {
return true;
},
enableQueryBatching: true,
legacyRelations: "omit",
};
console.log('database url: ', process.env.DATABASE_URL);
app.use(postgraphile(process.env.DATABASE_URL, "public", postgraphileOptions));
console.log('port: ', process.env.PORT);
app.listen(process.env.PORT);