diff --git a/src/index.ts b/src/index.ts index e4bcdbc..f25a2d3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,13 +1,14 @@ import 'reflect-metadata'; import express from 'express'; import AppDataSource from './config/ormconfig'; -import router from './route/protected.routes'; +import indexRoutes from './routes/index'; const app = express(); const PORT = process.env.PORT || 3000; app.use(express.json()); -// app.use('/users', userRoutes); +// Use the index routes +app.use('/api/v1', indexRoutes); AppDataSource.initialize() .then(() => { @@ -20,10 +21,6 @@ AppDataSource.initialize() console.error('Error during Data Source initialization:', error); }); -app.get('/', (req, res) => { - res.send('Hello, world!'); -}); - app.use('/', router) diff --git a/src/routes/index.ts b/src/routes/index.ts new file mode 100644 index 0000000..1a0ff8f --- /dev/null +++ b/src/routes/index.ts @@ -0,0 +1,18 @@ +import { Router } from 'express'; +import userRoutes from './UserRoutes'; +// import productRoutes from './product.routes'; +// import storeRoutes from './store.routes'; + +const router = Router(); + +// Health Check Route +router.get('/health', (req, res) => { + res.status(200).json({ status: 'success', message: 'API is running!' }); +}); + +// Mount route modules +router.use('/users', userRoutes); +// router.use('/products', productRoutes); +// router.use('/stores', storeRoutes); + +export default router; \ No newline at end of file