anvil/striker-ui-api/routes/echo.js

18 lines
428 B
JavaScript
Raw Normal View History

2021-11-29 22:48:55 +00:00
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;