chore: replace hand-rolled layout() with @fastify/view + EJS
Convert all src/views/*.ts template-literal modules to .ejs templates under views/. Register @fastify/view plugin in server.ts with EJS engine and _layout.ejs as the layout file. Update route handlers to use reply.view() instead of reply.send(layout(...)). Delete the old TypeScript view modules and layout.ts. Closes #19
This commit is contained in:
29
views/_layout.ejs
Normal file
29
views/_layout.ejs
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<title><%= title %> — Nanodrop</title>
|
||||
<link rel="stylesheet" href="/public/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<% if (!hideHeader) { %>
|
||||
<header>
|
||||
<a href="/" class="logo">Nanodrop</a>
|
||||
<% if (authed) { %>
|
||||
<nav>
|
||||
<a href="/upload">Upload</a>
|
||||
<a href="/files">My Files</a>
|
||||
<form method="POST" action="/logout" style="display:inline">
|
||||
<button type="submit">Logout</button>
|
||||
</form>
|
||||
</nav>
|
||||
<% } %>
|
||||
</header>
|
||||
<% } %>
|
||||
<main>
|
||||
<%- body %>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user