Initial Filamenteka setup - Bambu Lab filament tracker
- React + TypeScript frontend with automatic color coding - Confluence API integration for data sync - AWS Amplify deployment with Terraform - Support for all Bambu Lab filament colors including gradients
This commit is contained in:
30
server.js
Normal file
30
server.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import express from 'express';
|
||||
import { handler } from './src/pages/api/filaments.js';
|
||||
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
|
||||
app.get('/api/filaments', async (req, res) => {
|
||||
const event = {
|
||||
httpMethod: 'GET',
|
||||
headers: req.headers,
|
||||
queryStringParameters: req.query
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await handler(event);
|
||||
res.status(response.statusCode);
|
||||
|
||||
Object.entries(response.headers || {}).forEach(([key, value]) => {
|
||||
res.setHeader(key, value);
|
||||
});
|
||||
|
||||
res.send(response.body);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`API server running at http://localhost:${port}`);
|
||||
});
|
||||
Reference in New Issue
Block a user