mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-14 04:00:42 -04:00
* feat(next-api): add fastify-auth0-verify plugin * feat(next-api): add fastify-jwt-authz plugin * feat(next-api): accept privacy endpoint with scopes support * fix(next-api): ignore eslint and ts errors They will be fixed in a future PR when the package with errors has been updated Co-authored-by: Niraj Nandish <nirajnandish@icloud.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
26 lines
672 B
TypeScript
26 lines
672 B
TypeScript
import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
|
|
import type { NextFunction, NextHandleFunction } from '@fastify/middie';
|
|
|
|
export async function auth0Verify(
|
|
this: FastifyInstance,
|
|
request: FastifyRequest,
|
|
reply: FastifyReply
|
|
) {
|
|
await this.authenticate(request, reply);
|
|
}
|
|
|
|
type MiddieRequest = Parameters<NextHandleFunction>[0];
|
|
type MiddieResponse = Parameters<NextHandleFunction>[1];
|
|
|
|
export function testMiddleware(
|
|
req: MiddieRequest,
|
|
res: MiddieResponse,
|
|
next: NextFunction
|
|
) {
|
|
console.log('Test middleware running');
|
|
console.log(req.headers);
|
|
console.log(req.query);
|
|
res.setHeader('X-Test-Header', 'test');
|
|
next();
|
|
}
|