source: src/webservice/htdocs/index.php@ 92c9c7c

Last change on this file since 92c9c7c was 92c9c7c, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago
  • Improved htaccess rewrite rule (but not working right now)
    • started to implement database connection
    • Improved host url handling
    • Improved external handling

Signed-off-by: Joachim Langenbach <joachim.langenbach@…>

  • Property mode set to 100644
File size: 2.1 KB
Line 
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
23/**
24 * @brief Handles the stations (list) REST requests
25 */
26function stations(){
27 $stations = Array();
28// $station = Array();
29// $station["id"] = "123456";
30// $station["name"] = "Station Name";
31// $station["longitude"] = 52.320;
32// $station["latitude"] = 48;
33// $station["city"] = "Krefeld";
34// $station["values"] = Array();
35// $station["values"][] = "temperature";
36// $station["values"][] = "humidity";
37// $station["url"] = "stations/". $station["id"];
38// $stations[] = $station;
39 echo json_encode($stations);
40}
41
42$app = new \Slim\Slim
43(
44 array
45 (
46 "mode" => "production"
47 )
48);
49$app->setName("siweather");
50
51// Only invoked if mode is "production"
52$app->configureMode('production', function () use ($app) {
53 $app->config(array(
54 'log.enable' => true,
55 'debug' => false
56 ));
57});
58// Only invoked if mode is "development"
59$app->configureMode('development', function () use ($app) {
60 $app->config(array(
61 'log.enable' => false,
62 'debug' => true
63 ));
64});
65
66// $app->notFound(function () use ($app) {
67// $app->render(getConfig("webserviceBaseUrl")+ "404.html");
68// });
69
70// $app->get("/stations", "stations");
71$app->get("/stations", "stations");
72$app->get("/stations/:uuid", function ($uuid){
73 echo "stations 123";
74});
75$app->run();
76
77?>
78
Note: See TracBrowser for help on using the repository browser.