Initial commit: TicketingSystem
Internal ticketing app with CTI routing, severity levels, and n8n integration. Stack: Express + TypeScript + Prisma + PostgreSQL / React + Vite + Tailwind - JWT auth for users, API key auth for service accounts (Goddard/n8n) - CTI hierarchy (Category > Type > Item) for ticket routing - Severity 1-5, auto-close resolved tickets after 14 days - Gitea Actions CI/CD building separate server/client images - Production docker-compose.yml with Traefik integration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import 'express-async-errors'
|
||||
import express from 'express'
|
||||
import cors from 'cors'
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
import authRoutes from './routes/auth'
|
||||
import ticketRoutes from './routes/tickets'
|
||||
import ctiRoutes from './routes/cti'
|
||||
import userRoutes from './routes/users'
|
||||
import { authenticate } from './middleware/auth'
|
||||
import { errorHandler } from './middleware/errorHandler'
|
||||
import { startAutoCloseJob } from './jobs/autoClose'
|
||||
|
||||
dotenv.config()
|
||||
|
||||
if (!process.env.JWT_SECRET) {
|
||||
console.error('FATAL: JWT_SECRET is not set')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const app = express()
|
||||
|
||||
app.use(cors({ origin: process.env.CLIENT_URL || 'http://localhost:5173' }))
|
||||
app.use(express.json())
|
||||
|
||||
// Public
|
||||
app.use('/api/auth', authRoutes)
|
||||
|
||||
// Protected
|
||||
app.use('/api/tickets', authenticate, ticketRoutes)
|
||||
app.use('/api/cti', authenticate, ctiRoutes)
|
||||
app.use('/api/users', authenticate, userRoutes)
|
||||
|
||||
app.use(errorHandler)
|
||||
|
||||
startAutoCloseJob()
|
||||
|
||||
const PORT = Number(process.env.PORT) || 3000
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server running on port ${PORT}`)
|
||||
})
|
||||
Reference in New Issue
Block a user