Deepseek feat: add input validation, error handling, performance hooks, and session overlap checks across routes
This commit is contained in:
@@ -1,34 +0,0 @@
|
|||||||
import express from "express";
|
|
||||||
import 'dotenv/config'
|
|
||||||
import mongoose from "mongoose";
|
|
||||||
|
|
||||||
import TeachersRoutes from './Teachers/teachers.routes.js'
|
|
||||||
import UsersRoutes from "./Users/users.routes.js";
|
|
||||||
import SessionsRoutes from "./Sessions/sessions.routes.js";
|
|
||||||
|
|
||||||
const app = express();
|
|
||||||
const PORT = 3000;
|
|
||||||
|
|
||||||
app.use(express.json());
|
|
||||||
|
|
||||||
app.get("/", (_req, res) => {
|
|
||||||
res.json({ message: "Hello from Express + TypeScript!" });
|
|
||||||
});
|
|
||||||
|
|
||||||
const MONGO_URI = process.env.MONGO_URI!;
|
|
||||||
|
|
||||||
// Users
|
|
||||||
app.use('/users', UsersRoutes);
|
|
||||||
|
|
||||||
// Teachers
|
|
||||||
app.use('/teachers', TeachersRoutes);
|
|
||||||
|
|
||||||
|
|
||||||
// Sessions
|
|
||||||
app.use('/sessions', SessionsRoutes);
|
|
||||||
|
|
||||||
|
|
||||||
app.listen(PORT, async() => {
|
|
||||||
console.log(`Server running at http://localhost:${PORT}`);
|
|
||||||
await mongoose.connect(MONGO_URI);
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user