You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

28 lines
696 B

<?php
require '/var/www-php/Adafruit-Feed-Mangler/app.rc.php';
$app = new \Slim\Slim;
$app->config('debug', false);
$app->error(function (\Exception $e) use ($app) {
print "something broke";
});
$app->get('/', function () use ($app) {
$term = 'adafruit';
if ($app->request->get('search')) {
$term = $app->request->get('search');
}
if ($app->request->get('type') === 'json') {
$app->response->headers->set('Content-Type', 'application/json');
print \Adafruit\FeedMangler\Mangler::getSearchJson($term);
} else {
$app->response->headers->set('Content-Type', 'application/atom+xml');
print \Adafruit\FeedMangler\Atom::searchResults($term);
}
});
$app->run();