1
0
mirror of https://github.com/yldio/copilot.git synced 2024-09-22 06:13:50 +03:00
copilot/spikes/stacks/redux-thunk/src/server/index.js

29 lines
729 B
JavaScript
Raw Normal View History

2016-10-14 12:45:12 +03:00
const webpack = require('webpack');
const webpackConfig = require('../config/webpack.config.js');
const WebpackDevServer = require('webpack-dev-server');
const graphqlHTTP = require('express-graphql');
const schema = require('./schema');
// WebpackDevServer should only be used for dev
const server = new WebpackDevServer(webpack(webpackConfig), {
hot: true,
historyApiFallback: {
index: './static/index.html'
},
setup: function(app) {
app.use('/graphql', graphqlHTTP({
schema: schema,
graphiql: true
}));
},
publicPath: webpackConfig.output.publicPath
});
server.listen(3000, 'localhost', (err) => {
if (err) {
console.log(err);
}
console.log('Listening at localhost:3000');
});