--- /dev/null
+<?php
+// don't forget to active - MOD_Rewrite - on Apache.
+// php 5.4+ (Trait + simplified array declaration)
+
+include("var.php");
+include("ressource/Type.php");
+include("ressource/RestAPI.php");
+$request = explode('/', $_SERVER['REQUEST_URI']);
+$ressourceRequested = $request[4];
+$id = null;
+if(isset($request[5])) {
+ if($request[5] !== "") {
+ if($request[5][0] !== "?") {
+ $id = $request[5];
+ }
+ }
+}
+
+/*if(!isset(getallheaders()['apiKey']) || getallheaders()['apiKey'] !== "azerty") {
+ header("HTTP/1.1 403 Forbidden");
+ print("<i>You're not able to acces this rest API</i><br /><b>*close the door*</b>");
+ exit(0);
+}*/
+
+$restAPI = new DoNothingRestAPI();
+
+switch($ressourceRequested){
+ case "user":
+ include("rest/user/UserAPI.php");
+ $restAPI = new UserAPI($id);
+ break;
+ case "authentication":
+ include("rest/user/AuthenticationAPI.php");
+ $restAPI = new AuthenticationAPI();
+ break;
+ case "registration":
+ include("rest/user/RegistrationAPI.php");
+ $restAPI = new RegistrationAPI();
+ break;
+ case "project":
+ include("rest/project/ProjectAPI.php");
+ $restAPI = new ProjectAPI($id);
+ break;
+ case "bookmark":
+ include("rest/project/BookmarkAPI.php");
+ $restAPI = new BookmarkAPI($id);
+ break;
+ case "account":
+ include("rest/user/AccountAPI.php");
+ $restAPI = new AccountAPI($id);
+ break;
+ case "funding":
+ include("rest/project/FundingAPI.php");
+ $restAPI = new FundingAPI($id);
+ break;
+ case "commentary":
+ include("rest/project/CommentAPI.php");
+ $restAPI = new CommentAPI($id);
+ break;
+}
+
+$restAPI->serve();
+
+?>