source: src/webservice/htdocs/index.php@ 1c92d58

Last change on this file since 1c92d58 was 1c92d58, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago

First version of a getStations implementation and related tests

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[1c92d58]1<?php
2/*
3 Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 MA 02110-1301 USA.
19*/
20
21include("config/config.php");
22
23function stations(){
24 $stations = Array();
25// $station = Array();
26// $station["id"] = "123456";
27// $station["name"] = "Station Name";
28// $station["longitude"] = 52.320;
29// $station["latitude"] = 48;
30// $station["city"] = "Krefeld";
31// $station["values"] = Array();
32// $station["values"][] = "temperature";
33// $station["values"][] = "humidity";
34// $station["url"] = "stations/". $station["id"];
35// $stations[] = $station;
36 echo json_encode($stations);
37}
38
39$app = new \Slim\Slim
40(
41 array
42 (
43 "mode" => "production"
44 )
45);
46$app->setName("siweather");
47
48// Only invoked if mode is "production"
49$app->configureMode('production', function () use ($app) {
50 $app->config(array(
51 'log.enable' => true,
52 'debug' => false
53 ));
54});
55// Only invoked if mode is "development"
56$app->configureMode('development', function () use ($app) {
57 $app->config(array(
58 'log.enable' => false,
59 'debug' => true
60 ));
61});
62
63// $app->notFound(function () use ($app) {
64// $app->render('404.html');
65// });
66
67// $app->get("/stations", "stations");
68$app->get("/stations", "stations");
69$app->get("/stations/:uuid", function ($uuid){
70 echo "stations 123";
71});
72$app->run();
73
74?>
75
Note: See TracBrowser for help on using the repository browser.