forked from DebaucheryLibrarian/traxxx
Added internal GraphQL client, using GraphQL for scenes API.
This commit is contained in:
@@ -3,22 +3,18 @@
|
||||
const path = require('path');
|
||||
const config = require('config');
|
||||
const express = require('express');
|
||||
const { postgraphile } = require('postgraphile');
|
||||
const Router = require('express-promise-router');
|
||||
const bodyParser = require('body-parser');
|
||||
const session = require('express-session');
|
||||
const KnexSessionStore = require('connect-session-knex')(session);
|
||||
const nanoid = require('nanoid');
|
||||
|
||||
const PgConnectionFilterPlugin = require('postgraphile-plugin-connection-filter');
|
||||
const PgSimplifyInflectorPlugin = require('@graphile-contrib/pg-simplify-inflector');
|
||||
const PgOrderByRelatedPlugin = require('@graphile-contrib/pg-order-by-related');
|
||||
|
||||
const logger = require('../logger')(__filename);
|
||||
const knex = require('../knex');
|
||||
const { ActorPlugins, SitePlugins, ReleasePlugins } = require('./plugins/plugins');
|
||||
const errorHandler = require('./error');
|
||||
|
||||
const pg = require('./postgraphile');
|
||||
|
||||
const {
|
||||
fetchScene,
|
||||
fetchScenes,
|
||||
@@ -45,34 +41,7 @@ async function initServer() {
|
||||
const router = Router();
|
||||
const store = new KnexSessionStore({ knex });
|
||||
|
||||
const connectionString = `postgres://${config.database.user}:${config.database.password}@${config.database.host}:5432/${config.database.database}`;
|
||||
|
||||
app.use(postgraphile(
|
||||
connectionString,
|
||||
'public',
|
||||
{
|
||||
// watchPg: true,
|
||||
dynamicJson: true,
|
||||
graphiql: true,
|
||||
enhanceGraphiql: true,
|
||||
allowExplain: () => true,
|
||||
// simpleCollections: 'only',
|
||||
simpleCollections: 'both',
|
||||
graphileBuildOptions: {
|
||||
pgOmitListSuffix: true,
|
||||
connectionFilterRelations: true,
|
||||
},
|
||||
appendPlugins: [
|
||||
PgSimplifyInflectorPlugin,
|
||||
PgConnectionFilterPlugin,
|
||||
PgOrderByRelatedPlugin,
|
||||
...ActorPlugins,
|
||||
...SitePlugins,
|
||||
...ReleasePlugins,
|
||||
],
|
||||
},
|
||||
));
|
||||
|
||||
app.use(pg);
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
router.use('/media', express.static(config.media.path));
|
||||
|
||||
Reference in New Issue
Block a user