-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
44 lines (30 loc) · 934 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
// Require setting
require_once( './src/settings.php' );
// Require Composer autoloader
require_once( './vendor/autoload.php' );
$router = new \Fruit\Fruit();
// Declare routes
$router->addroutes( array(
/**
* GET routes
*/
// Get all posts
array( 'GET', '/^posts(\/all)*$/', 'Chest\Controllers\PostController#getAll' ),
// Get limited number of posts bu page
array( 'GET', '/^posts\/(?P<page>\w+)(\/ls\/(?P<num>\d+))*$/', 'Chest\Controllers\PostController#getPageList' ),
//Get post by id
array( 'GET', '/^posts\/id\/(?P<id>\d+)$/', 'Chest\Controllers\PostController#getById' ),
// Get post by title
array( 'GET', '/^posts\/title\/(?P<title>\w+)$/', 'Chest\Controllers\PostController#getByTitle' ),
// Get list of pages
array( 'GET', '/^pages$/', 'Chest\Controllers\PageController#getList' ),
/*
* POST routes
*/
// PUT routes
// DELETE routes
));
$router->go();
exit;
?>