<commit_before>#!/usr/bin/env node
var assert = require('assert');

var express = require('express');

var client = require('./lib/rest-sugar-client');


main();

function main() {
    var port = 3000;
    var apiPrefix = '/api';
    var app = express();

    app.configure(function() {
        app.use(express.methodOverride()); // handles PUT
        app.use(express.bodyParser()); // handles POST
        app.use(app.router);
    });

    app.get(apiPrefix, function(req, res) {
        res.json({
            libraries: {}
        });
    });

    app.get(apiPrefix + '/libraries', function(req, res) {
        assert.equal(req.method, 'GET');

        res.json([{
            name: 'demo library'
        }]);
    });

    app.post(apiPrefix + '/libraries', function(req, res) {
        res.json(req.body);
    });

    console.log('Running tests!');
    app.listen(3000, function(err) {
        if(err) return console.error(err);

        client.api('http://localhost:' + port + apiPrefix, function(err, api) {<commit_msg>Hook up port parameter properly<commit_after>#!/usr/bin/env node
var assert = require('assert');

var express = require('express');

var client = require('./lib/rest-sugar-client');


main();

function main() {
    var port = 3000;
    var apiPrefix = '/api';
    var app = express();

    app.configure(function() {
        app.use(express.methodOverride()); // handles PUT
        app.use(express.bodyParser()); // handles POST
        app.use(app.router);
    });

    app.get(apiPrefix, function(req, res) {
        res.json({
            libraries: {}
        });
    });

    app.get(apiPrefix + '/libraries', function(req, res) {
        assert.equal(req.method, 'GET');

        res.json([{
            name: 'demo library'
        }]);
    });

    app.post(apiPrefix + '/libraries', function(req, res) {
        res.json(req.body);
    });

    console.log('Running tests!');
    app.listen(port, function(err) {
        if(err) return console.error(err);

        client.api('http://localhost:' + port + apiPrefix, function(err, api) {
{'fraction_non_alphanumeric': 0.17743490838958534, 'fraction_numerical': 0.0057859209257473485, 'mean_word_length': 2.4184514003294892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4678236', 'n_tokens_mistral': 662, 'n_tokens_neox': 632, 'n_words': 130}