Files
stupid-apis/src/routes/api/array/arrayMax.js
T
johannesbot 56bd3ea604
Build and Deploy / build (push) Successful in 30s
Build Release / build (push) Successful in 22s
Build and Deploy / deploy (push) Successful in 26s
20 new API endpoints
2026-06-17 06:24:22 +02:00

12 lines
356 B
JavaScript

const express = require('express');
const router = express.Router();
router.post('/', (req, res) => {
const { input } = req.body;
if (!Array.isArray(input) || input.length === 0)
return res.status(400).json({ error: 'input must be a non-empty array' });
res.json({ ret: Math.max(...input.map(Number)) });
});
module.exports = router;