Angular RESTful API CRUD Application
Today, We want to share with you Angular RESTful API CRUD Application.
In this post we will show you AngularJS and CRUD Using RESTful APIs Example, hear for AngularJS and CRUD Using RESTful APIs Example we will give you demo and example for implement.
In this post, we will learn about Angular RESTful API CRUD Application with an example.
What is REST API?
This POST IN include,When a web service(API) use REST Architecture and Structure we call it a REST API. REST Means Shortly Representational State Transfer(REST_API). It relies on a stateless,It’s a client-server, cacheable and communications protocol, and API in virtually all cases, REST_API – HTTP protocol is used. REST(API/web-service) is an architecture style for designing-logic networked applications.
There are include in REST API(HTTP Methods Like GET,POST,PUT,DELETE).
RESTful GET Method operation
It’s a Request to the server and retrive fetch the data from database.
RESTful POST Method operation
Post Method operation to insert data to server from database.
RESTful PUT Method operation
All data send server to update database.
RESTful DELETE Method operation
It’s a delete data from database.
There are Following status code HTTP Status Codes
200 Success or OK
201 data Created
304 restriction or Not Modified
400 send client side to Bad Request
401 credentials wrong means Unauthorized
403 generate Forbidden
404 page not in this dir.Not Found
422 in Unprocessable Entity display
500 connection problems Internal Server Error
->api
–>log
–>Slim
–>dbConfig.php
–>index.php
–>functions.php
–>.htaccess
dbConfig.php
[php]
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);//Genrate Exception
return $dbConnection;
}
?>
[/php]
index.php
[php]
post(‘/doLogin’,’doLogin’);
$slim_app->get(‘/logout’,’logout’);
$slim_app->get(‘/loadUsers’,’loadUsers’);
$slim_app->post(‘/newUser’,’newUser’);
$slim_app->post(‘/editUser’,’editUser’);
$slim_app->get(‘/loadEditUser/:eid’,’loadEditUser’);
$slim_app->delete(‘/deleteUser/:did’,’deleteUser’);
$slim_app->run();
?>
[/php]