Skip to content
Snippets Groups Projects
personController.js 686 B
Newer Older
  • Learn to ignore specific revisions
  • const db = require('../models/db');
    
    Bastien's avatar
    Bastien committed
    const personServices = require('../services/person');
    
    Bastien's avatar
    Bastien committed
    exports.getPersonInformations = async (req, res, next) => {
    
        let personId = req.params.id;
    
    
    Bastien's avatar
    Bastien committed
        try {
            let result = await personServices.getPersonById(personId);
            res.status(200).json(result);
        } catch (error) {
    
    Bastien's avatar
    Bastien committed
            res.status(500).json({ error : error.toString()});
    
    Bastien's avatar
    Bastien committed
        }
    
    Bastien's avatar
    Bastien committed
    exports.getPersonMovies = async (req, res, next) => {
    
        let personId = req.params.id;
    
    
    Bastien's avatar
    Bastien committed
        try {
            let result = await personServices.getPersonMovies(personId);
            res.status(200).json(result);
        } catch (error) {
    
    Bastien's avatar
    Bastien committed
            res.status(500).json({ error : error.toString()});
    
    Bastien's avatar
    Bastien committed
        }