-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
23 changed files
with
650,049 additions
and
22 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
eda/eda_api/lib/module/funcionalidadUrl/funcionalidadUrl.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { NextFunction, Request, Response } from 'express'; | ||
import { HttpException } from '../global/model/index'; | ||
|
||
|
||
export class FuncionalidadUrlController { | ||
|
||
|
||
static async checkUrl(req: Request, res: Response, next: NextFunction) { | ||
|
||
try { | ||
const response = await req.body | ||
const {url} = response; | ||
|
||
// Hacemos un fetch a la url solicitada por el frontend | ||
fetch(url) | ||
.then( r => { | ||
res.status(200).json({ | ||
ok: true, | ||
msg: 'Respuesta correcta', | ||
}); | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching data', error); | ||
res.status(500).json({ | ||
ok: false, | ||
msg: 'Error en la petición o en la URL', | ||
}); | ||
}); | ||
|
||
} catch (err) { | ||
return next(new HttpException(501, 'Error in SMPT configuration file')); | ||
} | ||
|
||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
eda/eda_api/lib/module/funcionalidadUrl/funcionalidadUrl.router.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as express from 'express'; | ||
import { authGuard } from '../../guards/auth-guard'; | ||
import { roleGuard } from '../../guards/role-guard'; | ||
import { FuncionalidadUrlController } from './funcionalidadUrl.controller'; | ||
|
||
const router = express.Router(); | ||
|
||
router.post('/check', authGuard, roleGuard, FuncionalidadUrlController.checkUrl); | ||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.