Open
Description
Any example on how to run it with fastify? I was able to get postgraphile run with fastify. Now i am trying to include this plugin for file upload but not able to make it work.
Fastify with postgrapgile
const Fastify = require('fastify');
const helmet = require('fastify-helmet');
const cors = require('fastify-cors');
const Compress = require('fastify-compress');
const { postgraphile } = require('postgraphile');
const PgSimplifyInflectorPlugin = require('@graphile-contrib/pg-simplify-inflector');
const PostGraphileNestedMutations = require('postgraphile-plugin-nested-mutations');
const app = Fastify({
logger: true,
});
// Register Plugins
app.register(cors);
app.register(helmet);
app.register(Compress, {
global: true,
threshold: 256, // bytes; below this size will not be compressed
});
// app.use(expressCompression({threshold: 0})); // working
// app.register(fastifyCompression, {threshold: 0}); // not working
app.use(
postgraphile(
'postgres://postgres:postgres@localhost:5432/demo_1?sslmode=disable',
'app_public',
{
dynamicJson: true,
appendPlugins: [PgSimplifyInflectorPlugin, PostGraphileNestedMutations],
enhanceGraphiql: process.env.NODE_ENV !== 'production' ? true : false,
graphileBuildOptions: {
nestedMutationsSimpleFieldNames: true,
nestedMutationsDeleteOthers: false,
},
disableQueryLog: process.env.NODE_ENV !== 'production' ? true : false,
graphiql: process.env.NODE_ENV !== 'production' ? true : false,
watchPg: process.env.NODE_ENV !== 'production',
}
)
);
app.listen(process.env.PORT || 3000, (err) => {
if (err) {
app.log.error(err);
process.exit(1);
}
});
i tried combing with this plugin: https://www.npmjs.com/package/fastify-gql-upload but no luck
Metadata
Metadata
Assignees
Labels
No labels
Activity