Skip to content

Commit

Permalink
feat: fastify htmx example
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Sep 18, 2024
1 parent 7edb3dc commit 9464604
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fastifyFormbody from '@fastify/formbody';
import { Suspense } from '@kitajs/html/suspense';
import fastify from 'fastify';
import { setTimeout } from 'node:timers/promises';
import { fastifyKitaHtml } from '..';
import { fastifyKitaHtml } from '../packages/fastify-html-plugin/types';

const app = fastify({ logger: true });

Expand Down Expand Up @@ -84,6 +84,9 @@ app.post(
(req, rep) => {
const { username } = req.body as { username: string };
users.push(username);

// Safe is required to avoid xss attacks.
// Use `xss-scan` CLI to automatically check for forgotten `safe` props.
rep.html(<li safe>{username}</li>);
}
);
Expand Down

0 comments on commit 9464604

Please sign in to comment.