{"size": 546, "ext": "js", "max_stars_repo_path": "mini-webserver.js", "max_stars_repo_name": "agile-it/docker-mini-webserver", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "mini-webserver.js", "max_issues_repo_name": "agile-it/docker-mini-webserver", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "mini-webserver.js", "max_forks_repo_name": "agile-it/docker-mini-webserver", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.2222222222, "max_line_length": 53, "alphanum_fraction": 0.619047619}
var express = require('express');
var app = express();

var port = process.env.PORT0 || 3000;
var host = process.env.HOST || "0.0.0.0";


app.use(function (req, res, next) {
  var domain = req.hostname;
  domain = domain.substring(domain.indexOf('.') + 1);

  if (req.hostname !== "www."+domain) {
    res.append("Location","https://www."+domain);
    res.status(302).end();
  }
  next();
});

app.use(express.static(__dirname + '/public'));


app.use(function(req, res, next) {
  res.status(404).end();
});

var server = app.listen(port, host);
