$ git clone https://github.com/michaelocana/gamecity.git gamecity.local
$ cd gamecity
$ nano gamecity.local/gamecity/web/sites/default/settings.local.php
Add this code to settings.local.php
<?php
$databases['default']['default'] = array (
'database' => 'drupal9',
'username' => 'drupal9',
'password' => 'drupal9',
'prefix' => '',
'host' => 'database',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
$settings['hash_salt'] = 'DUMMY_DEV_HASH';
$cookie_domain = '.localhost';
$ lando start
$ cd gamecity.local/gamecity
$ lando db-import dump/gamecity.sql
username: gamecity
password : drupalAdm1n
$ lando drush cr
$ lando drush cim -y
$ lando drush updb -y
$ lando drush cr
Open browser: http://gamecity.lndo.site/
* API to query games
/api/v1/gamecity
parameters: category=[puzzle/arcade,action,all]
/api/v1/gamecity/add/game
parameters :
_format=json
Content-type=application/json
data=["title" => "value", "description => "description", "category" => "puzzle"]
var settings = {
"url": "http://gamecity.lndo.site/api/v1/gamecity?category=puzzle",
"method": "GET",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"X-CSRF-Token": "vnJvTj7OskmVLUAtvbZThx-bFmh2XrgSluN4zLNApzw"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Implemented using views : http://gamecity.lndo.site/admin/structure/views/view/gamecity
puzzle, action, arcade
var settings = {
"url": "http://gamecity.lndo.site/api/v1/gamecity/add/game?_format=json",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json"
},
"data": JSON.stringify({
"title": "test3",
"description": "this is description",
"category": "puzzle"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Implemented using rest module : http://gamecity.lndo.site/admin/config/services/rest/resource/api_gamecity_add/edit and resource custom module.
admin > configuration > Gamecity API Settings
http://gamecity.lndo.site/admin/gamecity/api/settings