Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -3,14 +3,8 @@ const app = express();
|
|
| 3 |
app.use(express.json());
|
| 4 |
|
| 5 |
app.post('/shipping-rates', (req, res) => {
|
| 6 |
-
console.log(req.body);
|
| 7 |
-
console.log(req.body.rate.items[0]);
|
| 8 |
-
|
| 9 |
// Compute the weight of all items
|
| 10 |
const weight = req.body.rate.items.reduce((acc, item) => acc + item.grams, 0);
|
| 11 |
-
console.log(weight);
|
| 12 |
-
|
| 13 |
-
|
| 14 |
res.json({ "rates": [ {
|
| 15 |
"service_name": "Transporteur privée",
|
| 16 |
"service_code": "CA",
|
|
|
|
| 3 |
app.use(express.json());
|
| 4 |
|
| 5 |
app.post('/shipping-rates', (req, res) => {
|
|
|
|
|
|
|
|
|
|
| 6 |
// Compute the weight of all items
|
| 7 |
const weight = req.body.rate.items.reduce((acc, item) => acc + item.grams, 0);
|
|
|
|
|
|
|
|
|
|
| 8 |
res.json({ "rates": [ {
|
| 9 |
"service_name": "Transporteur privée",
|
| 10 |
"service_code": "CA",
|