Skip to content

Commit

Permalink
Create index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Oct 31, 2024
1 parent b5d9302 commit 0a56bac
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions blockchain_integration/pi_network/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// api/index.js

const express = require('express');
const userRoutes = require('./routes/userRoutes');
const contractRoutes = require('./routes/contractRoutes');
const errorHandlingMiddleware = require('../middleware/errorHandling');

const app = express();
const PORT = process.env.PORT || 3000;

app.use(express.json()); // Parse JSON request bodies

// API Routes
app.use('/api/users', userRoutes);
app.use('/api/contracts', contractRoutes);

// Error handling middleware
app.use(errorHandlingMiddleware);

app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
});

0 comments on commit 0a56bac

Please sign in to comment.