How to use the postgraphile function in postgraphile

To help you get started, we’ve selected a few postgraphile examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chadfurman / rpg-boilerplate / api / src / index.js View on Github external
import express from 'express'
import postgraphile from 'postgraphile'
// import PluginName from './plugins/PluginName'

// const plugins = [
//   PluginName
// ]

const app = express()
const pgConnectionString = process.env.DB_URI
const pgSchemas = process.env.POSTGRAPHILE_SCHEMAS.split(',')
const pgOptions = JSON.parse(process.env.POSTGRAPHILE_OPTIONS)
// pgOptions.appendPlugins = plugins

app.use(postgraphile(pgConnectionString, pgSchemas, pgOptions))


app.listen(3000, '0.0.0.0', function () {
  console.info('NODE_ENV: ' + process.env.NODE_ENV)
  console.info('Postgraphile API started.\n')
})
github storyforj / fervor / src / server / server.js View on Github external
export default async function startApp(options = {}) {
  const app = new Koa();

  app.use(requestLogger(logger));
  app.use(handleErrors(options));

  const pgqlOpts = setPGQLOpts(options);
  const pgPool = createPgPool(options, pgqlOpts);
  await startSchemaWatcher(pgPool, 'public', pgqlOpts);
  app.use(postgraphile(pgPool, 'public', pgqlOpts));

  app.use(cors());
  app.use(bodyParser());
  app.use(cookie());

  // load any user defined middleware
  const middleware = load('middleware', { options, default: () => {} });
  if (middleware.default) {
    middleware.default({ app, logger, options });
  }

  app.use(appManifest(options));
  if (!options.disableWebpack) {
    // eslint-disable-next-line global-require
    await require('../config/webpack.dev').default(app, options);
  }

postgraphile

A GraphQL schema created by reflection over a PostgreSQL schema 🐘 (previously known as PostGraphQL)

MIT
Latest version published 1 year ago

Package Health Score

78 / 100
Full package analysis