mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-10 07:25:35 +00:00
refactor: split backend by context instead of type 'controllers/models/...'
This commit is contained in:
27
app/auth/routes/auth_routes.ts
Normal file
27
app/auth/routes/auth_routes.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { middleware } from '#start/kernel';
|
||||
import router from '@adonisjs/core/services/router';
|
||||
const AuthController = () => import('#auth/controllers/auth_controller');
|
||||
|
||||
const ROUTES_PREFIX = '/auth';
|
||||
|
||||
/**
|
||||
* Auth routes for unauthicated users
|
||||
*/
|
||||
router
|
||||
.group(() => {
|
||||
router.get('/google', [AuthController, 'google']).as('auth');
|
||||
router
|
||||
.get('/callback', [AuthController, 'callbackAuth'])
|
||||
.as('auth.callback');
|
||||
})
|
||||
.prefix(ROUTES_PREFIX);
|
||||
|
||||
/**
|
||||
* Routes for authenticated users
|
||||
*/
|
||||
router
|
||||
.group(() => {
|
||||
router.get('/logout', [AuthController, 'logout']).as('auth.logout');
|
||||
})
|
||||
.middleware([middleware.auth()])
|
||||
.prefix(ROUTES_PREFIX);
|
||||
1
app/auth/routes/routes.ts
Normal file
1
app/auth/routes/routes.ts
Normal file
@@ -0,0 +1 @@
|
||||
import './auth_routes.js';
|
||||
Reference in New Issue
Block a user