-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.php
More file actions
36 lines (29 loc) · 761 Bytes
/
index.php
File metadata and controls
36 lines (29 loc) · 761 Bytes
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
<?php
//Autoload
$loader = require 'vendor/autoload.php';
//Instanciando objeto
$app = new \Slim\Slim(array(
'templates.path' => 'templates'
));
//Listando todas
$app->get('/pessoas/', function() use ($app){
(new \controllers\Pessoa($app))->lista();
});
//get pessoa
$app->get('/pessoas/:id', function($id) use ($app){
(new \controllers\Pessoa($app))->get($id);
});
//nova pessoa
$app->post('/pessoas/', function() use ($app){
(new \controllers\Pessoa($app))->nova();
});
//edita pessoa
$app->put('/pessoas/:id', function($id) use ($app){
(new \controllers\Pessoa($app))->editar($id);
});
//apaga pessoa
$app->delete('/pessoas/:id', function($id) use ($app){
(new \controllers\Pessoa($app))->excluir($id);
});
//Rodando aplicação
$app->run();