New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop devServer in Testing, Prod #9

Closed
lautarodragan opened this Issue Jul 28, 2017 · 2 comments

Comments

2 participants
@lautarodragan
Member

lautarodragan commented Jul 28, 2017

We shouldn't need to use devServer in any environment other than local (and still, should be able to run web in local without it if wanted).

We currently need it since it has a few hacks in it.

TODO:

  • List all those hacks that shouldn't be there
  • Create tickets to track the moving of that code to other places

@lautarodragan lautarodragan self-assigned this Jul 28, 2017

@lautarodragan

This comment has been minimized.

Show comment
Hide comment
@lautarodragan

lautarodragan Jul 29, 2017

Member

Looks like all that needs to be done is:

  1. All the code related to badges, covered in poetapp/poet#261
  2. The proxies should go away and docker-compose.yml should expose the needed ports in the needed services

The file should look something like this after stripping all that out:

const path = require('path')
const express = require('express')
const proxy = require('express-http-proxy');
const url = require('url');
const app = express();
const moment = require('moment')
const fetch = require('isomorphic-fetch')
const webpack = require('webpack')

const config = require('./webpack.config');

const compiler = webpack(config);

const webpackConfig = {
  noInfo: true,
  progress: true,
  publicPath: "/",
  stats: {
    colors: true
  }
};

app.use(require('webpack-dev-middleware')(compiler, webpackConfig));

app.use(require('webpack-hot-middleware')(compiler));

app.use('*', function (req, res, next) {
  var filename = path.join(compiler.outputPath, 'index.html');
  compiler.outputFileSystem.readFile(filename, function(err, result){
    if (err) {
      return next(err);
    }
    res.set('content-type','text/html');
    res.send(result);
    res.end();
  });
});

app.listen(3000, '0.0.0.0', function (err) {
  if (err) {
    console.log(err);
    return;
  }

  console.log('Listening at http://localhost:3000');
});
Member

lautarodragan commented Jul 29, 2017

Looks like all that needs to be done is:

  1. All the code related to badges, covered in poetapp/poet#261
  2. The proxies should go away and docker-compose.yml should expose the needed ports in the needed services

The file should look something like this after stripping all that out:

const path = require('path')
const express = require('express')
const proxy = require('express-http-proxy');
const url = require('url');
const app = express();
const moment = require('moment')
const fetch = require('isomorphic-fetch')
const webpack = require('webpack')

const config = require('./webpack.config');

const compiler = webpack(config);

const webpackConfig = {
  noInfo: true,
  progress: true,
  publicPath: "/",
  stats: {
    colors: true
  }
};

app.use(require('webpack-dev-middleware')(compiler, webpackConfig));

app.use(require('webpack-hot-middleware')(compiler));

app.use('*', function (req, res, next) {
  var filename = path.join(compiler.outputPath, 'index.html');
  compiler.outputFileSystem.readFile(filename, function(err, result){
    if (err) {
      return next(err);
    }
    res.set('content-type','text/html');
    res.send(result);
    res.end();
  });
});

app.listen(3000, '0.0.0.0', function (err) {
  if (err) {
    console.log(err);
    return;
  }

  console.log('Listening at http://localhost:3000');
});

@lautarodragan lautarodragan assigned wzalazar and unassigned wzalazar Sep 29, 2017

@wzalazar wzalazar self-assigned this Oct 13, 2017

@wzalazar wzalazar closed this Oct 23, 2017

@wzalazar

This comment has been minimized.

Show comment
Hide comment
@wzalazar

wzalazar Oct 23, 2017

Member

was closes with poetapp/poet#337

Member

wzalazar commented Oct 23, 2017

was closes with poetapp/poet#337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment