Skip to content

2.2 Controllers

leonardo Rico edited this page Nov 20, 2017 · 1 revision

Controller

Create a file with .js extension in the /src/api/controllers folder

src/api/controllers/hello.js

import { result, notFound, error } from 'express-easy-helper';
import Hello from '../models/hello';

export function list(req, res) {
  return Hello.find().exec()
        .then(notFound(res))
        .then(result(res))
        .catch(error(res));
}

More info express-easy-helper

Clone this wiki locally