Visitar URL original
Create types for error handler with 4 params · Issue #23 · types/express · GitHub
Skip to content

Create types for error handler with 4 params #23

Open

Description

@nicoabie

Activity

  1. darylteo commented on Nov 19, 2024

    @darylteo

    And also for promise support

    Starting with Express 5, route handlers and middleware that return a Promise will call next(value) automatically when they reject or throw an error. For example:

    app.get('/user/:id', async (req, res, next) => {
      const user = await getUserById(req.params.id)
      res.send(user)
    })
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions