Closed pford68 closed 8 years ago
Template:
/** * <h2>Angular-D3 Visualization</h2> * * <p> * Command-line Options: * <ul> * <li>--main: starts the server</li> * <li>--port: defaults to 9000</li> * </ul> * </p> * */ process.env.NODE_ENV = process.env.NODE_ENV || 'development'; var args = require("minimist")(process.argv); // For express var express = require("express"), bodyParser = require("body-parser"), methodOverride = require("method-override"), config = require("config"), app = express(); //============================================================ Middleware app.use(methodOverride()); // parse application/x-www-form-urlencoded // Causes POST requests to hang when proxied. See https://github.com/nodejitsu/node-http-proxy/issues/530 //app.use(bodyParser.urlencoded({ extended: true })); // parse application/json app.use(bodyParser.json()); app.use("/ngd3-client", express.static("./build")); app.get("/ngd3-services/test", function(req, res){ res.send("OK") }); //=========================================================== Public exports.start = function(port){ app.listen(port, function(){ console.log("Starting Angular-D3 client on port " + port + "...."); }); }; if (args.main){ exports.start(args.port || process.env.PORT || config.port || 9000); }
I copy from the resources directory, rather than generate.
Template: