source: src/webservice/htdocs/index.php@ 8c356c1

Last change on this file since 8c356c1 was 8c356c1, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago
  • Finished setup
    • Added tests for setup
    • Added translation to setup
  • Property mode set to 100644
File size: 2.2 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
[8c356c1]21require(__DIR__ ."/inc/envsetup.php");
22
23$settings = new SiWeather\Webservice\WebserviceConfig();
[1c92d58]24
[92c9c7c]25/**
26 * @brief Handles the stations (list) REST requests
27 */
[1c92d58]28function stations(){
29 $stations = Array();
30// $station = Array();
31// $station["id"] = "123456";
32// $station["name"] = "Station Name";
33// $station["longitude"] = 52.320;
34// $station["latitude"] = 48;
35// $station["city"] = "Krefeld";
36// $station["values"] = Array();
37// $station["values"][] = "temperature";
38// $station["values"][] = "humidity";
39// $station["url"] = "stations/". $station["id"];
40// $stations[] = $station;
41 echo json_encode($stations);
42}
43
44$app = new \Slim\Slim
45(
46 array
47 (
48 "mode" => "production"
49 )
50);
51$app->setName("siweather");
52
53// Only invoked if mode is "production"
54$app->configureMode('production', function () use ($app) {
55 $app->config(array(
56 'log.enable' => true,
57 'debug' => false
58 ));
59});
60// Only invoked if mode is "development"
61$app->configureMode('development', function () use ($app) {
62 $app->config(array(
63 'log.enable' => false,
64 'debug' => true
65 ));
66});
67
68// $app->notFound(function () use ($app) {
[92c9c7c]69// $app->render(getConfig("webserviceBaseUrl")+ "404.html");
[1c92d58]70// });
71
72// $app->get("/stations", "stations");
73$app->get("/stations", "stations");
74$app->get("/stations/:uuid", function ($uuid){
75 echo "stations 123";
76});
77$app->run();
78
79?>
Note: See TracBrowser for help on using the repository browser.