-
I wish documentation made it clearer as to when fastify methods like export const authenticatedCookieFastifyPlugin = fastifyPlugin(
async (instance) => {
instance.addHook('onRequest', async (request, reply) => {
const userAccountId = request.session.get('userAccountId');
if (userAccountId) {
// The only purpose this serve is to determine whether https://contra.com/
// serves the landing pages or the contra-web-app.
void reply.setCookie('contra_authenticated', 'true', {
httpOnly: true,
maxAge: ONE_DAY,
path: '/',
});
} else if (request.cookies.contra_authenticated) {
void reply.clearCookie('contra_authenticated');
}
});
},
{
name: 'authenticated-cookie',
},
); Do app.get<{ Params: { domain: string } }>(
'/domains/validate/:domain',
async (request, reply) => {
const domain = request.params.domain;
const status = await services.customDomain.getCustomDomainStatus({
domain,
});
if (status === 'ACTIVE') {
void reply.code(204).send();
} else {
void reply.code(404).send();
}
},
); Does Reading examples from documentation it is not clear. |
Beta Was this translation helpful? Give feedback.
Answered by
mcollina
May 19, 2023
Replies: 1 comment 8 replies
-
No, this is just an odd rule added by some validator. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
or