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