Ignore:
Timestamp:
Aug 28, 2015, 3:29:08 PM (11 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
master
Children:
b858e6f
Parents:
851179e
Message:
  • Rewrites are now working
    • Setup is now accessable via Slim too
    • Added 404 template to Slim app
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/webservice/htdocs/index.php

    r851179e r1e37648  
    4646        array
    4747        (
    48                 "mode" => "production"
     48                "mode" => $settings->getConfig("mode"),
    4949        )
    5050);
    51 $app->setName("siweather");
     51$app->setName("SiWeather Webservice");
    5252
    5353// Only invoked if mode is "production"
    5454$app->configureMode('production', function () use ($app) {
    5555    $app->config(array(
    56         'log.enable' => true,
    57         'debug' => false
     56        "log.enable" => true,
     57        "log.level" => \Slim\Log::WARN,
     58        "debug" => false,
    5859    ));
    5960});
    … …  
    6162$app->configureMode('development', function () use ($app) {
    6263    $app->config(array(
    63         'log.enable' => false,
    64         'debug' => true
     64        "log.enable" => true,
     65        "log.level" => \Slim\Log::DEBUG,
     66        "debug" => true
    6567    ));
    6668});
    6769
    68 // $app->notFound(function () use ($app) {
    69 //     $app->render(getConfig("webserviceBaseUrl")+ "404.html");
    70 // });
     70$app->notFound(function () use ($app) {
     71        $html = "";
     72    if($app->config("debug")){
     73        ob_start();
     74        phpinfo( INFO_VARIABLES ^ INFO_ENVIRONMENT );
     75        $html = ob_get_contents();
     76        ob_end_clean();
     77    }
     78    $app->render("404.php", array("dump" => $html));
     79});
    7180
    72 // $app->get("/stations", "stations");
     81$app->get("/setup", function () use ($app){
     82        $app->render("setup.php");
     83});
     84
    7385$app->get("/stations", "stations");
    7486$app->get("/stations/:uuid", function ($uuid){
    7587        echo "stations 123";
    7688});
     89
     90
     91
    7792$app->run();
    7893
Note: See TracChangeset for help on using the changeset viewer.