[Ivan Diaz] - Update server folder structure
This commit is contained in:
parent
aaf986083c
commit
0244585193
|
@ -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
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"require": {
|
||||
"slim/slim": "~2.0",
|
||||
"gabordemooij/redbean": "~4.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "5.0.*"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
$mysql_host = 'localhost';
|
||||
$mysql_user = 'os_dev';
|
||||
$mysql_password = 'os_dev';
|
||||
$mysql_database = 'os_dev';
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
$app->group('/user', function () use ($app) {
|
||||
|
||||
$app->get('/new', function () use ($app) {
|
||||
echo "You have the new";
|
||||
});
|
||||
});
|
|
@ -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();
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
$mysql_host = 'localhost';
|
||||
$mysql_user = 'os_dev';
|
||||
$mysql_password = 'os_dev';
|
||||
$mysql_database = 'os_dev';
|
|
@ -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
Loading…
Reference in New Issue