<commit_before><?php

require_once(__DIR__ . '/vendor/autoload.php');
require_once(__DIR__ . '/config.php');

$app = new \Slim\Slim();
$twitter = new Twitter(
    $config['apiKey'],
    $config['apiSecret'],
    $config['accessToken'],
    $config['accessTokenSecret']
);

$app->get('/', function() {
    echo 'hello';
});

$app->get('/update-twitter-feed', function() {
    echo 'twitter-feed';
});

$app->run();<commit_msg>Added tweets json call with caching and stubs for other endpoints<commit_after><?php

require_once(__DIR__ . '/vendor/autoload.php');
require_once(__DIR__ . '/config.php');

$app = new \Slim\Slim();

Twitter::$cacheDir = __DIR__ . '/cache';
Twitter::$cacheExpire = 60;

$twitter = new Twitter(
    $config['apiKey'],
    $config['apiSecret'],
    $config['accessToken'],
    $config['accessTokenSecret']
);

function json_response($data) {
    header('Content-Type: application/json', true);
    echo json_encode($data);
}

$app->get('/', function() use ($config, $twitter) {
    // $results = $twitter->load(Twitter::ME, 100, array('screen_name' => $config['accountName']));
});

$app->get('/tweets', function() use ($config, $twitter) {
    $results = $twitter->load(Twitter::ME, 100, array('screen_name' => $config['accountName']));
    json_response($results);
});

$app->get('/submit', function() use ($config) {
    echo 'form';
});

$app->post('/submit', function() use ($config, $twitter) {
    echo 'blah';
});

$app->run();
{'fraction_non_alphanumeric': 0.2242798353909465, 'fraction_numerical': 0.0054869684499314125, 'mean_word_length': 4.766798418972332, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3242963', 'n_tokens_mistral': 499, 'n_tokens_neox': 487, 'n_words': 95}