Last active
June 29, 2016 15:21
-
-
Save ramsaylanier/64ed345904dfbb88418f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint no-console: 0 */ | |
import express from 'express'; | |
import webpack from 'webpack'; | |
import WebpackDevServer from 'webpack-dev-server'; | |
import webpackMiddleware from 'webpack-dev-middleware'; | |
import webpackHotMiddleware from 'webpack-hot-middleware'; | |
import config from './webpack.config.js'; | |
import { apolloServer } from 'apollo-server'; | |
import Schema from './schema/typeDefinitions'; | |
import Resolvers from './schema/resolveFunctions'; | |
import { privateSettings } from './settings/settings'; | |
const APP_PORT = 3000; | |
const GRAPHQL_PORT = 8080; | |
const graphQLServer = express(); | |
let app = express(); | |
graphQLServer.use('/', apolloServer({ | |
graphiql: true, | |
pretty: true, | |
schema: Schema, | |
resolvers: Resolvers | |
})); | |
graphQLServer.listen(GRAPHQL_PORT, () => console.log( | |
`GraphQL Server is now running on http://localhost:${GRAPHQL_PORT}` | |
)); | |
const compiler = webpack(config); | |
app = new WebpackDevServer(compiler, { | |
hot: true, | |
historyApiFallback: true, | |
contentBase: 'src', | |
proxy: {'/graphql': `http://localhost:${GRAPHQL_PORT}`}, | |
publicPath: config.output.publicPath, | |
stats: { | |
colors: true, | |
hash: false, | |
timings: true, | |
chunks: false, | |
chunkModules: false, | |
modules: false | |
} | |
}); | |
app.use(webpackHotMiddleware(compiler)); | |
app.listen(APP_PORT, () => { | |
console.log(`App is now running on http://localhost:${APP_PORT}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment