|
|
|
@ -21,6 +21,7 @@ const express = require("express");
|
|
|
|
|
const expressPromiseRouter = require("express-promise-router");
|
|
|
|
|
const assert = require("assert");
|
|
|
|
|
const path = require("path");
|
|
|
|
|
const yargs = require("yargs");
|
|
|
|
|
|
|
|
|
|
const pipe = require("@promistream/pipe");
|
|
|
|
|
const fromNodeStream = require("@promistream/from-node-stream");
|
|
|
|
@ -33,9 +34,10 @@ const isString = require("@validatem/is-string");
|
|
|
|
|
const initialize = require("../src/initialize");
|
|
|
|
|
const errors = require("../src/errors");
|
|
|
|
|
|
|
|
|
|
assert(process.argv.length >= 4);
|
|
|
|
|
let configurationPath = process.argv[2];
|
|
|
|
|
let listenHost = process.argv[3];
|
|
|
|
|
let argv = yargs.argv;
|
|
|
|
|
let configurationPath = argv._[0];
|
|
|
|
|
let listenHost = argv.listenHost ?? "127.0.0.1";
|
|
|
|
|
let listenPort = argv.listenPort ?? 3000;
|
|
|
|
|
|
|
|
|
|
let absoluteConfigurationPath = path.join(process.cwd(), configurationPath);
|
|
|
|
|
let configuration = require(absoluteConfigurationPath);
|
|
|
|
@ -133,7 +135,7 @@ return Promise.try(() => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.use(router);
|
|
|
|
|
app.listen({ host: listenHost, port: 3000 }, () => {
|
|
|
|
|
console.log("Server listening on port 3000");
|
|
|
|
|
app.listen({ host: listenHost, port: listenPort }, () => {
|
|
|
|
|
console.log(`API server listening on port ${listenPort}, host ${listenHost}`);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|