Http.get calls twice

Hi,
When I use http.get from app it calls once but executed twice on api.
So, when I say if record doesn’t exist add record, else return error.
It adds the record and returns the error.

even this logs twice
$app->get(’/store/purchase/item’, function () use ($app, $config, $store_model) {
error_log(“entered”);

I couldn’t find the solution so far.
Thanks in advance

What does your index.php file look like? Are you perhaps calling $app->run() more than once? Are you possibly including a routes file more than once? If you manually error, can you follow the stack trace and see where things are duplicating? Do you have Xdebug running so you can manually step through and see where things are looping?

Here is my index.php
I think there is a problem with the plugin I use on ionic. I’ll check that again.
I haven’t use Xdebug, I’ll check that too.
Thanks

<?php

error_reporting(E_ALL);

// Allow from any origin
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400');    // cache for 1 day
//header('Access-Control-Max-Age: 0');
}

// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
    header("Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS");
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
    header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
exit(0);
}

require 'vendor/autoload.php';

include 'src/Model.php';
include 'src/UserModel.php';
include 'src/GameModel.php';
include 'src/StoreModel.php';
include 'src/Config.php';


$config = new Config();
$user_model = new UserModel($config->getDatabaseInfo());
$game_model = new GameModel($config->getDatabaseInfo());
$store_model = new StoreModel($config->getDatabaseInfo());

$app = new \Slim\Slim(array(
'debug' => true
));

include 'src/user.php';
include 'src/game.php';
include 'src/store.php';

$app->get('/', function() use($app) {
   // $app->response->setStatus(200);
echo "Welcome to Slim 3.0 based API";
});

$app->run();

It looks like a Slim 2.0 application:

$app = new \Slim\Slim(array(
'debug' => true
));