Spaces:
Paused
Paused
File size: 535 Bytes
57291f1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
const express = require('express');
const app = express();
app.use(express.json());
app.post('/shipping-rates', (req, res) => {
// Compute the weight of all items
const weight = req.body.rate.items.reduce((acc, item) => acc + item.grams, 0);
res.json({ "rates": [ {
"service_name": "Transporteur privée",
"service_code": "CA",
"total_price": "1295",
"description": "",
"currency": "EUR"
},
]});
});
app.listen(3000, () => console.log('Shipping API running on port 3000')); |