SHOW:
|
|
- or go back to the newest paste.
| 1 | const apiAdapter = require('../../apiAdapter');
| |
| 2 | const {
| |
| 3 | URL_SERVICE_MEDIA | |
| 4 | } = process.env; | |
| 5 | ||
| 6 | const api = apiAdapter(URL_SERVICE_MEDIA); | |
| 7 | ||
| 8 | module.exports = async (req, res) => {
| |
| 9 | try {
| |
| 10 | const media = await api.post('/media', req.body);
| |
| 11 | return res.json(media.data); | |
| 12 | } catch (error) {
| |
| 13 | // if (error.code === 'ECONNREFUSED') {
| |
| 14 | // return res.status(500).json({
| |
| 15 | // status: 'error', | |
| 16 | // mesage: 'service unavailable' | |
| 17 | // }); | |
| 18 | // } | |
| 19 | // const {
| |
| 20 | // status, | |
| 21 | // data | |
| 22 | // } = error.response; | |
| 23 | // return res.status(status).json(data); | |
| 24 | console.log(error); | |
| 25 | } | |
| 26 | } |