A simple telbook
web-application, using REST backend written in php
and simple js/jquery
frontend.
- Browser opens
index.html
(you may omit it from the URL) index.html
loads allclient/js
files and makes the app interactive.- When browser AJAX-es to URL (that doesn't physically exist as a file)
.htaccess
reroutes request toserver/index.php
. index.php
setups error handling and creates$db
,$request
and$response
. Then callsrouter.php
.router.php
matches the URL and HTTP method and executes piece of code. Sends JSON response.- Browser receives JSON and renders the data appropriately. Uses
client-render.js
.
.htaccess (for URL rewriting at the server backend, mod_rewrite needed)
HTML/CSS (browser visualization)
AJAX/JSON (transport of data between server and browser)
JQuery.js Library: https://api.jquery.com/ (ver 3.0+)
PHP: http://php.net/manual/en/ (ver 7.0+)
MySQL database (with 3 tables: persons, telephones, teltypes)
* [GET] persons
* [GET, POST, DELETE] persons/{ID}
* [GET] persons/{ID}/telephones
* [GET] telephones
* [GET, POST, DELETE] telephones/{ID}
* [GET] teltypes
* person: {id:1, fname:"Krali", lname:"Marko", address:"St. Petersburg 63"}
* teltype: {id:2, name:"Mobile"}
* telephone: {id:5, person_id:1, teltype_id:2, number:"0893199422"}
* message: {type:"error", text:"An Error Ocurred!"}
* server-response: {code:200, messages:[], person/persons/telephones...}