Skip to content

Commit

Permalink
Create index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
AravindRajeshkanna authored Sep 18, 2024
1 parent 5cba998 commit f835896
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const express = require('express');
const app = express();
const port = process.env.PORT || 3000;

// Basic middleware to parse JSON
app.use(express.json());

// Define a simple route for the API
app.get('/health', (req, res) => {
res.status(200).json({ status: 'API is healthy' });
});

// Sample API route for demonstration
app.get('/api/data', (req, res) => {
res.status(200).json({ message: 'Here is your data!' });
});

// Start the server
app.listen(port, () => {
console.log(`API running at http://localhost:${port}`);
});

module.exports = app;

0 comments on commit f835896

Please sign in to comment.