[Ivan Diaz] - Update server folder structure

This commit is contained in:
Ivan Diaz 2015-10-28 20:47:40 -03:00
parent aaf986083c
commit 0244585193
1411 changed files with 1239 additions and 13 deletions

View File

@ -7,7 +7,3 @@ for t in $TABLES
do
mysql -u os_dev -pos_dev os_dev -e "DROP TABLE $t"
done
# EXECUTE SQL
mysql -u os_dev -pos_dev os_dev < src/server/mock_db/database.sql

9
server/composer.json Normal file
View File

@ -0,0 +1,9 @@
{
"require": {
"slim/slim": "~2.0",
"gabordemooij/redbean": "~4.2"
},
"require-dev": {
"phpunit/phpunit": "5.0.*"
}
}

1143
server/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

5
server/config.php Normal file
View File

@ -0,0 +1,5 @@
<?php
$mysql_host = 'localhost';
$mysql_user = 'os_dev';
$mysql_password = 'os_dev';
$mysql_database = 'os_dev';

View File

@ -0,0 +1,7 @@
<?php
$app->group('/user', function () use ($app) {
$app->get('/new', function () use ($app) {
echo "You have the new";
});
});

27
server/index.php Normal file
View File

@ -0,0 +1,27 @@
<?php
require_once 'config.php';
require_once 'vendor/autoload.php';
// REDBEAN CONFIGURATION
use RedBeanPHP\Facade as RedBean;
RedBean::setup('mysql:host='. $mysql_host .';dbname=' . $mysql_database, $mysql_user, $mysql_password);
// SLIM FRAMEWORK
\Slim\Slim::registerAutoLoader();
$app = new \Slim\Slim();
// LOAD MODELS
spl_autoload_register(function ($class) {
$classPath = "models/{$class}.php";
if(file_exists($classPath)) {
include $classPath;
}
});
// LOAD CONTROLLERS
foreach (glob('controllers/*.php') as $controller) {
include $controller;
}
$app->run();

14
server/models/User.php Normal file
View File

@ -0,0 +1,14 @@
<?php
class User {
private $_id;
private $_user;
private function __construct($id = 0) {
$this->_id = $id;
$this->_user = RedBean::load('users', $id);
}
public function showUserDetails() {
return $this->_user;
}
}

5
server/src/config.php Normal file
View File

@ -0,0 +1,5 @@
<?php
$mysql_host = 'localhost';
$mysql_user = 'os_dev';
$mysql_password = 'os_dev';
$mysql_database = 'os_dev';

12
server/src/index.php Normal file
View File

@ -0,0 +1,12 @@
<?php
$app->get('/hello/:name', function ($name) {
$book = RedBean::dispense('book');
$book->title = $name;
$book->author = 'Charles Xavier';
$id = RedBean::store($book);
echo $id;
});
$app->run();

Some files were not shown because too many files have changed in this diff Show More