diff --git a/src/app.ts b/src/app.ts index b578039..da2b4f9 100644 --- a/src/app.ts +++ b/src/app.ts @@ -16,6 +16,17 @@ const app = express(); app.use(jsonParser); app.use(express.urlencoded({ extended: true })); +app.get('/', (_req, res) => { + res.json({ + message: 'Welcome to Echo Service! Send your requests to /echo endpoint', + availableEndpoints: { + echo: '/echo', + health: '/health' + }, + documentation: SERVICE_INFO.SOURCE_CODE + }); +}); + app.get('/health', (_req, res) => { const healthResponse: HealthCheckResponse = { status: 'healthy', diff --git a/src/tests/integration/app.test.ts b/src/tests/integration/app.test.ts index a2cd299..57f3c9f 100644 --- a/src/tests/integration/app.test.ts +++ b/src/tests/integration/app.test.ts @@ -1,6 +1,7 @@ import request from 'supertest'; import app from '../../app.js'; +import { SERVICE_INFO } from '../../config/constants.js'; import * as responseUtils from '../../utils/response.js'; const mockHostname = jest.fn().mockReturnValue('test-host'); @@ -22,6 +23,24 @@ describe('Echo Service Integration Tests', () => { process.env.NODE_ENV = originalEnv; }); + describe('GET /', () => { + it('should return 200 and welcome message with available endpoints', async () => { + const response = await request(app) + .get('/') + .expect('Content-Type', /json/) + .expect(200); + + expect(response.body).toEqual({ + message: 'Welcome to Echo Service! Send your requests to /echo endpoint', + availableEndpoints: { + echo: '/echo', + health: '/health' + }, + documentation: SERVICE_INFO.SOURCE_CODE + }); + }); + }); + describe('GET /health', () => { it('should return 200 and health status', async () => { const response = await request(app)