i have already set up a HMVC (i learned my setup from https://www.youtube.com/channel/UCkzjsv1ymTmdGpWTtZ7nM5A/videos ) and using it on my program. but i need it to re-code it into a RESTful type.
i have a MY_Controller.php
file
<?php
class MY_Controller extends MX_Controller {
function __construct()
{
parent::__construct();
$this->load->module('Templates');
$this->load->module('Login');
}
}
?>
this file is for loading modules easily. now i try to set up my REST_Controller etc. i have a folder like this
application
- - modules
- - - - Rest
- - - - - - controller
- - - - - - - Api.php
- - - - - - libraries
- - - - - - - Rest_Controller.php
- - - - - - - Format.php
- - - - - - config
- - - - - - - rest.php
- - - - - - models
- - - - - - views
i edited my REST_Controller.php
from
abstract class REST_Controller extends CI_Controller {
into
abstract class REST_Controller extends MY_Controller {
and my Api.php
is,
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH.'modules/Rest/libraries/REST_Controller.php';
class Api extends REST_Controller {
function __construct() {
parent::__construct();
}
function student_get(){
$this->response('My first API response');
}
}
but when i do http://localhost/FOLDERNAME/Api/student_get
on my browser
i got an error
404 Page Not Found
The page you requested was not found.
also i found this REST on mvc tutorial, it says that if i go to http://myapi.com/ it should open your codeigniter page, and it is good. but i only got
Buy this domain
The domain myapi.com may be for sale by its owner! etc.
i use Phil Sturgeon's REST Library
by the way
im still not sure if what im doing is right. can someone please tell me what the error is or how i can do it correctly. thanks