mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
28 lines
655 B
TypeScript
28 lines
655 B
TypeScript
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);
|