API DEMO

Hi everybody, I am learning about rest api. I need a demo project. Please send me for reference. I read http://docs.phalconphp.com/en/latest/reference/tutorial-rest.html but I have a problem when I select data from database. You can see the below error:

"Fatal error: Uncaught exception 'Phalcon\DI\Exception' with message 'Service 'db' was not found in the dependency injection container' in C:\xampp\htdocs\API\index.php:29 Stack trace: #0 [internal function]: Phalcon\DI->getShared('db') #1 [internal function]: Phalcon\Mvc\Model\Manager->getReadConnection(Object(Address)) #2 [internal function]: Phalcon\Mvc\Model->getReadConnection() #3 [internal function]: Phalcon\Mvc\Model\Query->_executeSelect(Array, NULL, NULL) #4 [internal function]: Phalcon\Mvc\Model\Query->execute(NULL, NULL) #5 C:\xampp\htdocs\API\index.php(29): Phalcon\Mvc\Model\Manager->executeQuery('SELECT * FROM A...') #6 [internal function]: {closure}() #7 C:\xampp\htdocs\API\index.php(67): Phalcon\Mvc\Micro->handle() #8 {main} thrown in C:\xampp\htdocs\API\index.php on line 29"

Please help me. Thank you very much.

Have you defined your db connection in the config file correctly and then setting them in the service file using the di component

It worked. Thank you very much.