<commit_before>import { BehaviorSubject, Subject} from '@reactivex/rxjs';
import * as express from 'express';
import { WebServer } from "./expressapp";
import { viwiWebSocket } from './viwiWebSocket';
import { viwiClientWebSocketMessage } from "./types";
import * as uuid from "uuid";
import * as fs from "fs";
import * as path from "path";
import { Service, Resource, Element, ResourceUpdate } from "./plugins/viwiPlugin";
import { viwiLogger } from "./log";
import { splitEvent } from "./helpers";


/**
 * parse command line options
 */
const commandLineArgs = require('command-line-args')
const optionDefinitions = [
  { name: 'verbosity', alias: 'v', type: String },
  { name: 'port', alias: 'p', type: Number }
]
const cla = commandLineArgs(optionDefinitions);
/** end parse command line argunments */

const logger = viwiLogger.getInstance().getLogger("general");
logger.transports["console"].level = cla.verbosity || 'silly'; // for debug

declare function require(moduleName: string): any;

const PLUGINDIR = path.join(__dirname, "plugins");
const BASEURI = "/";

var availableServices:{id:string;name:string;uri:string}[] = [];

// set up the server
var server:WebServer;

var run = (port?:number):Promise<void> => {
  return new Promise<void>((resolve, reject) => {
    server = new WebServer(cla.port);
    server.init(); // need to init

    server.app.get(BASEURI, (req: express.Request, res: express.Response, next: express.NextFunction) => {
      // respond
      res.status(200);
      res.json({
        status: "ok",
        data: availableServices
      });
    });<commit_msg>fix(main): port respect<commit_after>import { BehaviorSubject, Subject} from '@reactivex/rxjs';
import * as express from 'express';
import { WebServer } from "./expressapp";
import { viwiWebSocket } from './viwiWebSocket';
import { viwiClientWebSocketMessage } from "./types";
import * as uuid from "uuid";
import * as fs from "fs";
import * as path from "path";
import { Service, Resource, Element, ResourceUpdate } from "./plugins/viwiPlugin";
import { viwiLogger } from "./log";
import { splitEvent } from "./helpers";


/**
 * parse command line options
 */
const commandLineArgs = require('command-line-args')
const optionDefinitions = [
  { name: 'verbosity', alias: 'v', type: String },
  { name: 'port', alias: 'p', type: Number }
]
const cla = commandLineArgs(optionDefinitions);
/** end parse command line argunments */

const logger = viwiLogger.getInstance().getLogger("general");
logger.transports["console"].level = cla.verbosity || 'silly'; // for debug

declare function require(moduleName: string): any;

const PLUGINDIR = path.join(__dirname, "plugins");
const BASEURI = "/";

var availableServices:{id:string;name:string;uri:string}[] = [];

// set up the server
var server:WebServer;

var run = (port?:number):Promise<void> => {
  return new Promise<void>((resolve, reject) => {
    server = new WebServer(port || cla.port);
    server.init(); // need to init

    server.app.get(BASEURI, (req: express.Request, res: express.Response, next: express.NextFunction) => {
      // respond
      res.status(200);
      res.json({
        status: "ok",
        data: availableServices
      });
    });
{'fraction_non_alphanumeric': 0.15712507778469198, 'fraction_numerical': 0.001866832607342875, 'mean_word_length': 4.227642276422764, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4457179', 'n_tokens_mistral': 959, 'n_tokens_neox': 944, 'n_words': 275}