feat: add api controllers and routes for browser extension

This commit is contained in:
Sonny
2025-08-28 16:44:31 +02:00
parent 9aa71dad30
commit 208f2c631f
28 changed files with 353 additions and 5 deletions

View File

@@ -0,0 +1,18 @@
import UnAuthorizedException from '#api/tokens/exceptions/un_authorized_exception';
import { getTokenFromHeader } from '#api/tokens/lib/index';
import { inject } from '@adonisjs/core';
import { HttpContext } from '@adonisjs/core/http';
@inject()
export default class ApiTokenController {
async index(ctx: HttpContext) {
const token = getTokenFromHeader(ctx);
if (!token) {
throw new UnAuthorizedException();
}
return ctx.response.json({
message: 'Token is valid',
});
}
}