mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-11 08:43:04 +00:00
refactor: move routes in dedicated files + improve routes management
This commit is contained in:
31
start/routes/collection.ts
Normal file
31
start/routes/collection.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { middleware } from '#start/kernel';
|
||||
import router from '@adonisjs/core/services/router';
|
||||
const CollectionsController = () =>
|
||||
import('#controllers/collections_controller');
|
||||
|
||||
/**
|
||||
* Routes for authenticated users
|
||||
*/
|
||||
router
|
||||
.group(() => {
|
||||
router.get('/dashboard', [CollectionsController, 'index']).as('dashboard');
|
||||
|
||||
router
|
||||
.group(() => {
|
||||
router
|
||||
.get('/create', [CollectionsController, 'showCreatePage'])
|
||||
.as('collection.create-form');
|
||||
router
|
||||
.post('/', [CollectionsController, 'store'])
|
||||
.as('collection.create');
|
||||
|
||||
router
|
||||
.get('/edit', [CollectionsController, 'showEditPage'])
|
||||
.as('collection.edit-form');
|
||||
router
|
||||
.put('/:id', [CollectionsController, 'update'])
|
||||
.as('collection.edit');
|
||||
})
|
||||
.prefix('/collections');
|
||||
})
|
||||
.middleware([middleware.auth()]);
|
||||
Reference in New Issue
Block a user