You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
428 B
18 lines
428 B
3 years ago
|
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;
|