Example #1
0
//etusivu
$routes->get('/', function () {
    HelloWorldController::home();
});
//tuotteisiin liittyviä toimintoja
$routes->post('/tuote', 'check_logged_in', function () {
    TuoteController::store();
});
$routes->get('/tuote/uusi', 'check_logged_in', function () {
    TuoteController::create();
});
$routes->get('/tuote/:id', function ($id) {
    TuoteController::show($id);
});
$routes->get('/tuotteet', function () {
    TuoteController::tuotelista();
});
$routes->get('/tuote/:id/edit', 'check_logged_in', function ($id) {
    TuoteController::edit($id);
});
$routes->post('/tuote/:id/edit', 'check_logged_in', function ($id) {
    TuoteController::update($id);
});
$routes->post('/tuote/:id/remove', 'check_logged_in', function ($id) {
    TuoteController::remove($id);
});
//sisäänkirjautuminen ja käyttäjiin liittyvät polut
$routes->get('/kirjaudu', function () {
    UserController::login();
});
$routes->post('/kirjaudu', function () {