hagopj13 / node-express-boilerplate

A boilerplate for building production-ready RESTful APIs using Node.js, Express, and Mongoose
MIT License
7k stars 2.05k forks source link

use express-async-errors instead of catchAsync #227

Open ciey opened 1 year ago

ciey commented 1 year ago
const express = require('express');
require('express-async-errors');
const User = require('./models/user');
const app = express();

app.get('/users', async (req, res) => {
  const users = await User.findAll();
  res.send(users);
});
AlanGreyjoy commented 1 year ago

100%