transport-price / server.js
XciD's picture
XciD HF staff
Update server.js
7348666 verified
raw
history blame contribute delete
535 Bytes
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'));