feat: initialize project with Docker, PostgreSQL, Redis, and Vue.js frontend

- Added docker-compose.yml for PostgreSQL and Redis services with health checks.
- Created frontend directory with initial Vue.js setup including package.json, vite.config.ts, and TypeScript configuration.
- Implemented main application structure with App.vue and HomePage.vue components.
- Added message fetching and posting functionality in HomePage.vue.
- Included necessary styles and scripts for Ionic framework integration.
- Developed a dev-stack script to manage Docker containers and run backend/frontend servers.
This commit is contained in:
arussac
2026-05-29 11:47:52 +02:00
parent 2d00e78a9f
commit 12afb71a67
23 changed files with 981 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import { Hono } from "hono";
import { prisma } from "../lib/prisma";
const messages = new Hono();
// GET /api/messages — top-level threads with replies
messages.get("/", async (c) => {
const data = await prisma.message.findMany({
where: { parentId: null },
orderBy: { createdAt: "desc" },
take: 50,
include: {
replies: {
orderBy: { createdAt: "asc" },
},
},
});
return c.json(data);
});
// POST /api/messages — create a message or reply
messages.post("/", async (c) => {
const ip =
c.req.header("x-forwarded-for")?.split(",")[0].trim() ?? "127.0.0.1";
const body = await c.req.json<{ content: string; parentId?: string }>();
if (!body.content || body.content.trim().length === 0) {
return c.json({ error: "Content is required" }, 400);
}
if (body.content.length > 267) {
return c.json({ error: "Content exceeds 267 characters" }, 400);
}
const message = await prisma.message.create({
data: {
content: body.content.trim(),
authorIp: ip,
parentId: body.parentId ?? null,
},
});
return c.json(message, 201);
});
export default messages;