-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
31 lines (25 loc) · 920 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require('dotenv').config()
const express = require('express');
const cors = require('cors');
const axios = require('axios');
const app = express();
const PORT = process.env.PORT || 3050;
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.get('/', (req, res) => {
res.status(200).send('Hola carevrg!');
})
app.post('/api/interoperabilidad/GetEPSPersonaMSS', (req, res) => {
axios.post('https://paiwebservices.paiweb.gov.co:8081/api/interoperabilidad/GetEPSPersonaMSS', req.body)
.then(response => {
res.send(response.data);
})
.catch(error => {
console.error('Error en la solicitud:', error.response ? error.response.data : error.message);
res.status(500).send('Error en el servidor proxy.');
});
});
app.listen(PORT, () => {
console.log(`Proxy server runing on port: ${PORT}`);
});