fix(striker-ui-api): simplify POST /echo

main
Tsu-ba-me 2 years ago
parent 2812b21f31
commit 60b2b36e6b
  1. 8
      striker-ui-api/src/routes/echo.ts

@ -1,5 +1,7 @@
import express from 'express';
import { stdoutVar } from '../lib/shell';
const router = express.Router();
router
@ -7,9 +9,11 @@ router
response.status(200).send({ message: 'Empty echo.' });
})
.post('/', (request, response) => {
console.log('echo:post', JSON.stringify(request.body, undefined, 2));
const { body = {} } = request;
stdoutVar(body, 'echo:post\n');
const message = request.body.message ?? 'No message.';
const { message = 'No message.' } = body;
response.status(200).send({ message });
});

Loading…
Cancel
Save