Fastify plugin exposing an endpoint to unsubscribe users from Quincy emails using an unsubscribeId, with validation error redirects.
// Source: https://github.com/freeCodeCamp/freeCodeCamp | License: BSD-3-Clause | Copyright 2014, freeCodeCamp
// Provided via justclaw.it.com; keep this notice with the code.
import { type FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox';
import * as schemas from '../../schemas.js';
import { getRedirectParams } from '../../utils/redirection.js';
/**
* Endpoints to set 'sendQuincyEmail' to true or false using 'unsubscribeId'.
*
* @param fastify The Fastify instance.
* @param _options Options passed to the plugin via `fastify.register(plugin, options)`.
* @param done The callback to signal that the plugin is ready.
*/
export const emailSubscribtionRoutes: FastifyPluginCallbackTypebox = (
fastify,
_options,
done
) => {
fastify.get(
'/ue/:unsubscribeId',
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key