glennreyes/graphpack

Move src/config.js into graphpack.config.js

Closed this issue · 3 comments

I'd like to move the server config in src/config.js into our graphpack.config.js, eg.:

// graphpack.config.js
module.exports = {
  webpack: ({ config }) => ({ ...config }),
  server: {
    playground: true,
    introspection: true,
  },
}

After #11 we should be able to pass middlewares like this:

// graphpack.config.js
const express = require('express');
const cors = require('cors');

const app = express();
// Additional middleware can be mounted at this point
app.use('*', jwtCheck, requireAuth, checkScope);

module.exports = {
  webpack: ({ config }) => ({ ...config }),
  server: {
    playground: true,
    introspection: true,
    applyMiddleware: { app },
  },
}

Note that graphpack.config.js is also used from outside of webpack. So ideally we can use both CommonJS or ES module imports in this file.

Are we using backpack to bootstrap servers?

Thanks! No, I just fixed the title.

This is a good decision to move config.json > graphpack.config.js. 💯