()
| 17 | } |
| 18 | |
| 19 | register() { |
| 20 | program |
| 21 | .command("serve") |
| 22 | .description("Start a RESTful API webserver.") |
| 23 | .option("--hostname <hostname>", "The hostname to bind your API webserver to.") |
| 24 | .option("--port <port>", "The port to run your API webserver on.") |
| 25 | .option( |
| 26 | "--disable-origin-protection", |
| 27 | "If set, allows requests with origin header. Warning, this option exists for backwards compatibility reasons and exposes your environment to known CSRF attacks.", |
| 28 | ) |
| 29 | .on("--help", () => { |
| 30 | writeLn("\n Notes:"); |
| 31 | writeLn(""); |
| 32 | writeLn(" Default hostname is `localhost`."); |
| 33 | writeLn(" Use hostname `all` for no hostname binding."); |
| 34 | writeLn(" Default port is `8087`."); |
| 35 | writeLn(""); |
| 36 | writeLn(" Examples:"); |
| 37 | writeLn(""); |
| 38 | writeLn(" bw serve"); |
| 39 | writeLn(" bw serve --port 8080"); |
| 40 | writeLn(" bw serve --hostname bwapi.mydomain.com --port 80"); |
| 41 | writeLn("", true); |
| 42 | }) |
| 43 | .action(async (cmd) => { |
| 44 | await this.exitIfNotAuthed(); |
| 45 | const command = new ServeCommand(this.serviceContainer, this.configurator); |
| 46 | const response = await command.run(cmd); |
| 47 | this.processResponse(response); |
| 48 | }); |
| 49 | } |
| 50 | } |
nothing calls this directly
no test coverage detected