v1: delete old repo, initalize monorepo structure, config, database, and api packages basic setup

This commit is contained in:
2025-10-10 21:17:32 -04:00
parent ccceb77179
commit e7fff00001
75 changed files with 1362 additions and 1432 deletions

37
apps/api/src/index.ts Normal file
View File

@@ -0,0 +1,37 @@
import { prisma } from '@concord/database'; // types from prisma
import { Hono } from 'hono';
import { logger } from 'hono/logger';
const app = new Hono();
app.use('*', logger());
// Health check
app.get('/', (c) => {
return c.json({ ok: true, message: 'Hello from the Concord API' });
});
// route to get all users
const usersRoute = app.get('/users', async (c) => {
const users = await prisma.user.findMany({
select: {
id: true,
username: true,
nickname: true,
createdAt: true,
},
});
return c.json(users);
});
const port = Number.parseInt(process.env.PORT || '3000');
console.log(`API server listening on port ${port}`);
// This exports the type of our app's routes,
// which the client can use for end-to-end type safety.
export type AppType = typeof usersRoute;
export default {
port: 3000,
fetch: app.fetch,
};