azukiapp/azk

View on GitHub
src/libexec/package-tools/server

Summary

Maintainability
Test Coverage
#!/usr/bin/env node

// Load path
require.extensions['.conf'] = require.extensions['.json'];
var apptly = require('/root/.aptly.conf');

// App
var express = require('express');
var app     = express();
var server  = require('http').Server(app);

// server as static
var path = require('path');

var fedora_versions = [ "fedora20", "fedora23" ];
for (var i = 0; i < fedora_versions.length; i++) {
  var fedora_version = fedora_versions[i];
  app.use(path.join('/', fedora_version), express.static(
    path.resolve(path.join(__dirname, "..", "..", "..", "package", fedora_version))
  ));
}
app.use("/", express.static(path.join(apptly.rootDir, 'public')));

// run
server.listen(process.env.HTTP_PORT || 8080);