anvil/striker-ui-api/routes/echo.js
2022-03-18 22:50:40 -04:00

18 lines
428 B
JavaScript

const express = require('express');
const router = express.Router();
router
.get('/', (request, response) => {
response.status(200).send({ message: 'Empty echo.' });
})
.post('/', (request, response) => {
console.log('echo:post', JSON.stringify(request.body, undefined, 2));
const message = request.body.message ?? 'No message.';
response.status(200).send({ message });
});
module.exports = router;