Skip to content

Commit

Permalink
MV #4 closes #16 : Incluyendo ruta sentiment para acceder obtener sen…
Browse files Browse the repository at this point in the history
…timiento de peliculas
  • Loading branch information
LCinder committed Jan 24, 2022
1 parent 4a399c6 commit 6c6b9e9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,18 @@ server.get("/movies/:movie/keywords", async (request: any, reply) => {
});
/**********************************************************************************************************************/
/**********************************************************************************************************************/
server.get("/movies/:movie/sentiment", async (request: any, reply) => {
try {
const movie: Movie = await controller.getMovie(request.params.movie);
const sentiment: number[] = controller.getSentiment(movie);

request.log.info(`Extracted and sent sentiment from movie ${movie.title}`);
reply.code(200).send(JSON.stringify(sentiment));
} catch(err: any) {
request.log.error(`${err.message} : ${request.params.movie}`);
reply.code(404).send(JSON.stringify(err.message));
}
});
/**********************************************************************************************************************/
/**********************************************************************************************************************/
server.listen(5002)

0 comments on commit 6c6b9e9

Please sign in to comment.