-
move the application, system folders along with the index.php into the api directory
-
Open api/index.php and replace
-
First change System Folder:
$system_path = 'system'; // On line 100 v3.1.1
replace with:
$system_path = $_SERVER['DOCUMENT_ROOT'].'/api/'.'system';
-
Next, Change application folder:
$application_folder = 'application'; // On line 117 v3.1.1
replace with:
$application_folder = $_SERVER['DOCUMENT_ROOT'].'/api/'.'application';
-
-
Open the application/config folder. (api/application/config/config.php) Optional, only if composer is required
-
Change the composer autoload config
Find the composer autoload section
$config['composer_autoload'] = FALSE; //on line 139
and replace it with
$config['composer_autoload'] = APPPATH.'../../vendor/autoload.php'; require_once APPPATH.'../../vendor/autoload.php';
-
-
Update Your now.json
{ "version": 2, "public": true, "functions": { "api/*.php": { "runtime": "now-php@0.0.9" } }, "routes": [ { "src": "/assets/(.*)", "headers": { "cache-control": "s-maxage=604800" }, "dest": "/assets/$1" }, { "src": "/(.*)", "dest": "api/index.php" } ] }