Example #1
0
const startServer = function (specFile, routes, httpsOptions) {
  // if we got an array, normalize it to a map of URLs to file paths.
	if (Array.isArray(routes)) routes = routesArrayToMap(routes);

	const testTempDir = path.join(__dirname, "../../test-temp");

	const routesFile = writeRoutesFile(specFile, routes, testTempDir);

	const options = {
		command: "start",
		routesFile: routesFile,
		hot: false,
		port: PORT,
		jsPort: +PORT+1,
		logLevel: "emergency",
		timingLogLevel: "none",
		gaugeLogLevel: "no",
	};

	if (httpsOptions) {
		HTTPS = true;
		options.httpsOptions = httpsOptions;

		// Necessary to handle self-signed certificates.  This setting is fine for testing, but shouldn't be used in production
		// https://github.com/assaf/zombie/issues/1021
		process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
	} else {
		HTTPS = false;
	}

	return CLI.run(options);
};
Example #2
0
var startServer = function (specFile, routes) {
  // if we got an array, normalize it to a map of URLs to file paths.
	if (Array.isArray(routes)) routes = routesArrayToMap(routes);

	var testTempDir = path.join(__dirname, "../../test-temp");

	var routesFile = writeRoutesFile(specFile, routes, testTempDir);

	return CLI.run({
		command: "start",
		routesFile: routesFile,
		hot: false,
		port: PORT,
		jsPort: +PORT+1,
		logLevel: "emergency",
		timingLogLevel: "none",
		gaugeLogLevel: "no",
	});
}
Example #3
0
require("babel-core/register");

const {run, parseCliArgs} = require("react-server-cli");

run(parseCliArgs());