mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-10 15:35:35 +00:00
refactor: split backend by context instead of type 'controllers/models/...'
This commit is contained in:
35
app/collections/routes/collections_routes.ts
Normal file
35
app/collections/routes/collections_routes.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { middleware } from '#start/kernel';
|
||||
import router from '@adonisjs/core/services/router';
|
||||
const CollectionsController = () =>
|
||||
import('#collections/controllers/collections_controller');
|
||||
|
||||
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');
|
||||
|
||||
router
|
||||
.get('/delete', [CollectionsController, 'showDeletePage'])
|
||||
.as('collection.delete-form');
|
||||
router
|
||||
.delete('/:id', [CollectionsController, 'delete'])
|
||||
.as('collection.delete');
|
||||
})
|
||||
.prefix('/collections');
|
||||
})
|
||||
.middleware([middleware.auth()]);
|
||||
1
app/collections/routes/routes.ts
Normal file
1
app/collections/routes/routes.ts
Normal file
@@ -0,0 +1 @@
|
||||
import './collections_routes.js';
|
||||
Reference in New Issue
Block a user