Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const app = express();
- if (true) {
- const staticPath = path.join(__dirname, '../../build');
- console.log('Production, serving static files from ' + staticPath);
- console.log(path.resolve('/build'))
- console.log(path.resolve('build'))
- console.log(path.resolve('build/'))
- app.use(express.static(path.resolve('build')));
- } else {
- console.log('Env is not production, not serving any static files.');
- }
- app.use('/graphql', bodyParser.json(),
- graphqlExpress({
- context: { mongo },
- schema,
- })
- );
- app.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql' }));
- app.listen(3000, () => {
- console.log(`Go to http://localhost:${process.env.PORT || DEFAULT_PORT}/graphiql to run queries!`);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement