import express from 'express';

const app = express();
const port = 3000;

// Middleware
app.use(express.json());

// Health check endpoint
app.get('/health', (req, res) => {
  res.json({ status: 'ok', service: 'web5-dwn' });
});

// DWN API endpoints
app.post('/dwn', async (req, res) => {
  // Placeholder for DWN protocol implementation
  res.json({
    status: 'ok',
    message: 'DWN protocol endpoint (placeholder)'
  });
});

app.get('/dwn', async (req, res) => {
  res.json({
    status: 'ok',
    message: 'DWN query endpoint (placeholder)'
  });
});

// Start server
app.listen(port, '0.0.0.0', () => {
  console.log(`Web5 DWN listening on port ${port}`);
  console.log(`Storage path: ${process.env.DWN_STORAGE_PATH || '/app/data'}`);
});
