Revert "Prefix API routes for now"

This reverts commit 4728b6f414.
This commit is contained in:
Toby Zerner 2015-06-17 18:14:41 +09:30
parent 46920468d0
commit b8fe298b04

View File

@ -43,25 +43,23 @@ class ApiServiceProvider extends ServiceProvider
{
$this->app->instance('flarum.api.routes', $routes = new RouteCollection);
$prefix = '/api';
// Get forum information
$routes->get(
$prefix.'/forum',
'/forum',
'flarum.api.forum.show',
$this->action('Flarum\Api\Actions\Forum\ShowAction')
);
// Retrieve authentication token
$routes->post(
$prefix.'/token',
'/token',
'flarum.api.token',
$this->action('Flarum\Api\Actions\TokenAction')
);
// Send forgot password email
$routes->post(
$prefix.'/forgot',
'/forgot',
'flarum.api.forgot',
$this->action('Flarum\Api\Actions\ForgotAction')
);
@ -74,49 +72,49 @@ class ApiServiceProvider extends ServiceProvider
// List users
$routes->get(
$prefix.'/users',
'/users',
'flarum.api.users.index',
$this->action('Flarum\Api\Actions\Users\IndexAction')
);
// Register a user
$routes->post(
$prefix.'/users',
'/users',
'flarum.api.users.create',
$this->action('Flarum\Api\Actions\Users\CreateAction')
);
// Get a single user
$routes->get(
$prefix.'/users/{id}',
'/users/{id}',
'flarum.api.users.show',
$this->action('Flarum\Api\Actions\Users\ShowAction')
);
// Edit a user
$routes->put(
$prefix.'/users/{id}',
'/users/{id}',
'flarum.api.users.update',
$this->action('Flarum\Api\Actions\Users\UpdateAction')
);
// Delete a user
$routes->delete(
$prefix.'/users/{id}',
'/users/{id}',
'flarum.api.users.delete',
$this->action('Flarum\Api\Actions\Users\DeleteAction')
);
// Upload avatar
$routes->post(
$prefix.'/users/{id}/avatar',
'/users/{id}/avatar',
'flarum.api.users.avatar.upload',
$this->action('Flarum\Api\Actions\Users\UploadAvatarAction')
);
// Remove avatar
$routes->delete(
$prefix.'/users/{id}/avatar',
'/users/{id}/avatar',
'flarum.api.users.avatar.delete',
$this->action('Flarum\Api\Actions\Users\DeleteAvatarAction')
);
@ -129,21 +127,21 @@ class ApiServiceProvider extends ServiceProvider
// List activity
$routes->get(
$prefix.'/activity',
'/activity',
'flarum.api.activity.index',
$this->action('Flarum\Api\Actions\Activity\IndexAction')
);
// List notifications for the current user
$routes->get(
$prefix.'/notifications',
'/notifications',
'flarum.api.notifications.index',
$this->action('Flarum\Api\Actions\Notifications\IndexAction')
);
// Mark a single notification as read
$routes->put(
$prefix.'/notifications/{id}',
'/notifications/{id}',
'flarum.api.notifications.update',
$this->action('Flarum\Api\Actions\Notifications\UpdateAction')
);
@ -156,34 +154,34 @@ class ApiServiceProvider extends ServiceProvider
// List discussions
$routes->get(
$prefix.'/discussions',
'/discussions',
'flarum.api.discussions.index',
$this->action('Flarum\Api\Actions\Discussions\IndexAction')
);
// Create a discussion
$routes->post(
$prefix.'/discussions',
'/discussions',
'flarum.api.discussions.create',
$this->action('Flarum\Api\Actions\Discussions\CreateAction'));
// Show a single discussion
$routes->get(
$prefix.'/discussions/{id}',
'/discussions/{id}',
'flarum.api.discussions.show',
$this->action('Flarum\Api\Actions\Discussions\ShowAction')
);
// Edit a discussion
$routes->put(
$prefix.'/discussions/{id}',
'/discussions/{id}',
'flarum.api.discussions.update',
$this->action('Flarum\Api\Actions\Discussions\UpdateAction')
);
// Delete a discussion
$routes->delete(
$prefix.'/discussions/{id}',
'/discussions/{id}',
'flarum.api.discussions.delete',
$this->action('Flarum\Api\Actions\Discussions\DeleteAction')
);
@ -196,7 +194,7 @@ class ApiServiceProvider extends ServiceProvider
// List posts, usually for a discussion
$routes->get(
$prefix.'/posts',
'/posts',
'flarum.api.posts.index',
$this->action('Flarum\Api\Actions\Posts\IndexAction')
);
@ -204,28 +202,28 @@ class ApiServiceProvider extends ServiceProvider
// Create a post
// @todo consider 'discussions/{id}/links/posts'?
$routes->post(
$prefix.'/posts',
'/posts',
'flarum.api.posts.create',
$this->action('Flarum\Api\Actions\Posts\CreateAction')
);
// Show a single or multiple posts by ID
$routes->get(
$prefix.'/posts/{id}',
'/posts/{id}',
'flarum.api.posts.show',
$this->action('Flarum\Api\Actions\Posts\ShowAction')
);
// Edit a post
$routes->put(
$prefix.'/posts/{id}',
'/posts/{id}',
'flarum.api.posts.update',
$this->action('Flarum\Api\Actions\Posts\UpdateAction')
);
// Delete a post
$routes->delete(
$prefix.'/posts/{id}',
'/posts/{id}',
'flarum.api.posts.delete',
$this->action('Flarum\Api\Actions\Posts\DeleteAction')
);
@ -238,35 +236,35 @@ class ApiServiceProvider extends ServiceProvider
// List groups
$routes->get(
$prefix.'/groups',
'/groups',
'flarum.api.groups.index',
$this->action('Flarum\Api\Actions\Groups\IndexAction')
);
// Create a group
$routes->post(
$prefix.'/groups',
'/groups',
'flarum.api.groups.create',
$this->action('Flarum\Api\Actions\Groups\CreateAction')
);
// Show a single group
$routes->get(
$prefix.'/groups/{id}',
'/groups/{id}',
'flarum.api.groups.show',
$this->action('Flarum\Api\Actions\Groups\ShowAction')
);
// Edit a group
$routes->put(
$prefix.'/groups/{id}',
'/groups/{id}',
'flarum.api.groups.update',
$this->action('Flarum\Api\Actions\Groups\UpdateAction')
);
// Delete a group
$routes->delete(
$prefix.'/groups/{id}',
'/groups/{id}',
'flarum.api.groups.delete',
$this->action('Flarum\Api\Actions\Groups\DeleteAction')
);