chore: replace hand-rolled layout() with @fastify/view + EJS #20
Reference in New Issue
Block a user
Delete Branch "chore/ejs-view-templates"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
src/views/*.tstemplate-literal modules to.ejstemplates underviews/@fastify/viewplugin insrc/server.tswith EJS engine and_layout.ejsas the layout filereply.view()instead ofreply.send(layout(...))layout.ts<%= %>auto-escaping replaces manualescHtml()calls;<%- body %>confined to layout slot only (trusted template output)preHandler: requireAuth) unchanged on all protected routesSecurity
<%- body %>used only in_layout.ejsfor trusted template output, never for user inputfile-list.ejsembedsbaseUrland nanoid-formatf.idin an onclick attribute string — safe, same as original codeLockfile
Added
@fastify/view@11.1.1,ejs@5.0.2,@types/ejs@3.1.5and transitive deps. Lockfile regenerated from scratch (rm -rf node_modules package-lock.json && npm install --include=optional).npm civerified clean. Docker build verification deferred to CI (docker daemon not available in sandbox).Closes #19