33 lines
823 B
JavaScript
33 lines
823 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);
|
|
|
|
/**
|
|
* pass the database URL to PostGraphile for it to bootstrap the application
|
|
*/
|
|
app.use(postgraphile(process.env.DATABASE_URL, "zvbn_nvp", postgraphileOptions));
|
|
|
|
console.log('port: ', process.env.PORT);
|
|
app.listen(process.env.PORT);
|