12345678910111213141516171819202122232425262728 |
- var database = require('./database');
- var register_feedback_message = require('./register-feedback-message');
- const express = require('express')
- const app = express()
- app.use(express.json());
- const port = 3102
- const host = 'http://localhost';
- const chalk = require('chalk')
- database.start().then(() => {
- app.post('/receive', (req, res) => {
- //console.log(`Received message at ${chalk.italic('\'/receive\'')}`);
- register_feedback_message(req.body).then(() => {
- res.status(200).end();
- })
- .catch((error) => {
- console.log(chalk.red(error));
- res.status(500).json(error);
- })
- })
-
- app.listen(port, () => {
- console.log(`Customer Feedback Service listening at ${chalk.cyan(`${host}:${port}`)}`);
- });
- })
|