<commit_before>import {
    Context,
    RestCall,
    RestResult
} from "../core/types";

import {
    BaseService
} from "../core/base";

import { Server } from "http";
import { Express } from "express";
export { Express };

import awsServerlessExpress = require("aws-serverless-express");
import express = require("express");

export abstract class ExpressService extends BaseService {

    protected server: Server;

    protected async process(ctx: Context, call: RestCall): Promise<RestResult> {
        let rsrc = call.resource;
        if (rsrc.indexOf("{") > 0) rsrc = rsrc.substring(0, rsrc.indexOf("{") - 1);
        call.path = call.path.substring(call.path.indexOf(rsrc));
        for (let p in call.queryStringParameters) {
            call.queryStringParameters[p] = encodeURIComponent(call.queryStringParameters[p]);
        }

        let app: Express = express();
        // app.use(bodyParser.json());
        // app.use(awsServerlessExpressMiddleware.eventContext());

        this.setup(app, ctx, call);

        // TODO: Complete response
        return new Promise<RestResult>((resolve, reject) => {
            this.server = awsServerlessExpress.createServer(app);
            awsServerlessExpress.proxy(this.server, call, {
                succeed: (input) => resolve({
                    statusCode: input.statusCode,
                    headers: input.headers,
                    body: input.body
                }),
                fail: (err) => reject(err)
            } as any);
        });
    }<commit_msg>Private server field<commit_after>import {
    Context,
    RestCall,
    RestResult
} from "../core/types";

import {
    BaseService
} from "../core/base";

import { Server } from "http";
import { Express } from "express";
export { Express };

import awsServerlessExpress = require("aws-serverless-express");
import express = require("express");

export abstract class ExpressService extends BaseService {

    private server: Server;

    protected async process(ctx: Context, call: RestCall): Promise<RestResult> {
        let rsrc = call.resource;
        if (rsrc.indexOf("{") > 0) rsrc = rsrc.substring(0, rsrc.indexOf("{") - 1);
        call.path = call.path.substring(call.path.indexOf(rsrc));
        for (let p in call.queryStringParameters) {
            call.queryStringParameters[p] = encodeURIComponent(call.queryStringParameters[p]);
        }

        let app: Express = express();
        // app.use(bodyParser.json());
        // app.use(awsServerlessExpressMiddleware.eventContext());

        this.setup(app, ctx, call);

        // TODO: Complete response
        return new Promise<RestResult>((resolve, reject) => {
            this.server = awsServerlessExpress.createServer(app);
            awsServerlessExpress.proxy(this.server, call, {
                succeed: (input) => resolve({
                    statusCode: input.statusCode,
                    headers: input.headers,
                    body: input.body
                }),
                fail: (err) => reject(err)
            } as any);
        });
    }
{'fraction_non_alphanumeric': 0.1282798833819242, 'fraction_numerical': 0.001943634596695821, 'mean_word_length': 2.345612134344529, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '4899254', 'n_tokens_mistral': 841, 'n_tokens_neox': 825, 'n_words': 192}