def management_routes(): return [ get('/dashboard/management', UserManagementController.show), post('/dashboard/management/login_as_user', UserManagementController.login_as_user), get('/dashboard/management/swap', UserManagementController.swap_back_to_user), post('/dashboard/management/delete', UserManagementController.delete_user), get('/dashboard/management/show', UserManagementController.show_user), post('/dashboard/management/create', UserManagementController.create), ]
def routes(prefix='/dashboard'): return [ get('/dashboard', '/dashboard.controllers.DashboardController@show'), get('/dashboard/login', '/dashboard.controllers.AuthenticationController@show'), get('/dashboard/logout', '/dashboard.controllers.AuthenticationController@logout'), post('/dashboard/login', '/dashboard.controllers.AuthenticationController@authenticate'), ]
def test_post_sets_route(): assert routes.post('test', None) assert isinstance(routes.post('test', None), Post)
''' Web Routes ''' from masonite.helpers.routes import get, post from masonite.routes import RouteGroup as group ROUTES = [ get('/', 'HomeController@index').name('home'), get('/login', 'LoginController@show').name('login'), post('/login', 'LoginController@store'), get('/register', 'RegisterController@show').name('register'), post('/register', 'RegisterController@store').name('register'), get('/questions/@id:int', 'QuestionController@show').name('questions.show'), get('/categories/@id:int/questions', 'CategoryController@index').name('categories.questions.index'), get('/users/@id:int', 'UserController@show').name('users.show'), group( [ get('/logout', 'LoginController@logout').name('logout'), # Question Routes group([ get('/create', 'QuestionController@create').name('create'), post('', 'QuestionController@store').name('store'), post('/@id/answers', 'AnswerController@store').name('answers'), post('/@id/answers/@answer_id/accept', 'QuestionController@accept_answer').name('accept'), get('/@id/upvote', 'QuestionController@upvote').name('upvote'), get('/@id/downvote', 'QuestionController@downvote').name('downvote'), ], prefix='/questions',
''' Web Routes ''' from masonite.helpers.routes import get, post, group ROUTES = [ get('/', 'HomeController@index').name('welcome'), get('/login', 'LoginController@show').name('login'), post('/login', 'LoginController@store'), get('/register', 'RegisterController@show'), post('/register', 'RegisterController@store'), get('/questions/@id', 'QuestionController@show'), # auth middleware get('/logout', 'LoginController@logout').middleware('auth'), get('/ask', 'QuestionController@create').middleware('auth'), group('/questions', [ post('', 'QuestionController@store').middleware('auth'), post('/@id/answers', 'AnswerController@store').middleware('auth'), get('/@id/upvote', 'QuestionController@upvote').middleware('auth'), get('/@id/downvote', 'QuestionController@downvote').middleware('auth'), ]), get('/me/questions', 'QuestionController@questions').middleware('auth'), get('/me/answers', 'AnswerController@answers').middleware('auth'), ]