Initial project setup: monorepo structure with frontend and backend
- Set up pnpm workspace with frontend (React + Vite) and backend (Express + Prisma) - Configure TypeScript, ESLint, and Prettier - Add Prisma schema for database models (User, Course, Lesson, Progress, etc.) - Create basic frontend structure with Tailwind CSS and shadcn/ui - Add environment configuration files - Update README with project overview and setup instructions - Complete Phase 0: Project initialization
This commit is contained in:
44
packages/backend/src/server.ts
Normal file
44
packages/backend/src/server.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import helmet from 'helmet';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
// Middleware
|
||||
app.use(helmet());
|
||||
app.use(cors({
|
||||
origin: process.env.FRONTEND_URL || 'http://localhost:5173',
|
||||
credentials: true,
|
||||
}));
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
// Health check route
|
||||
app.get('/api/health', (_req, res) => {
|
||||
res.json({
|
||||
status: 'ok',
|
||||
message: 'Backend is running!',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
});
|
||||
|
||||
// Root route
|
||||
app.get('/', (_req, res) => {
|
||||
res.json({
|
||||
message: 'Znakovni.hr API',
|
||||
version: '1.0.0',
|
||||
});
|
||||
});
|
||||
|
||||
// Start server
|
||||
app.listen(PORT, () => {
|
||||
console.log(`🚀 Server running on http://localhost:${PORT}`);
|
||||
console.log(`📝 Environment: ${process.env.NODE_ENV || 'development'}`);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
||||
Reference in New Issue
Block a user