<?php
require '../../fly2/fly3.php';
//require 'config.php';

$app->action('hello', function (&$view) {
	echo "Hello, World!";
});

$app->action('foo', function (&$view) {
	print_r($_REQUEST);
	echo "api [foo] has been executed.";
});


$app->action('test', function (&$view) {
	$r = trim(file_get_contents("http://serviceapi.modtv.co.kr/skeleton/hello"));
	modtest($r, 'Hello, World!');

	$r = trim(file_get_contents("http://serviceapi.modtv.co.kr/skeleton/a"));
	modtest($r, 'api [a] has been executed.');

	$r = trim(file_get_contents("http://serviceapi.modtv.co.kr/skeleton/b"));
	modtest($r, 'api [b] has been executed.');
	
	echo "all tests are ok";
});


$app->action('index', function (&$view) {
	$view = 'index';	
	//return array(all=>$all, hospital=>$app->getHospital());
});

$app->action('put_iotdata', function() {
	$a = $_REQUEST;
	$q = "insert into iot_data (deviceid, data) values ('$a[deviceid]', '$a[data]')";
	query($q);
	echo "ok";
});

?>
