Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Express js event list?

I tried to find in the official documentation but have found no list of events for express.

Is there such a thing like 'route-matched' so I can do app.on('route-matched', () => {})?

Edit: in the official page, there was mount event, which is called when sup app mount on parent app. Beside this there is no link no information where to find the supported events.

like image 713
bigopon Avatar asked Nov 30 '16 23:11

bigopon


People also ask

What is on () in NodeJS?

As you may know, Node. js is evented, thus listening for events (pub-sub), just like jQuery or Backbone for example. In Node. js, you usually bind functions (using 'on' or other functions) to listen to events.

How do I trigger an event in NodeJS?

Emitting events: Every event is named event in nodejs. We can trigger an event by emit(event, [arg1], [arg2], […]) function. We can pass an arbitrary set of arguments to the listener functions.

Is Express still used?

Express is currently, and for many years, the de-facto library in the Node. js ecosystem. When you are looking for any tutorial to learn Node, Express is presented and taught to people.


1 Answers

Maybe you refer to the Nodejs http.ServerResponse events?

As stated in the Express js docs:

The res object is an enhanced version of Node’s own response object and supports all built-in fields and methods.

And then in the Node js docs:

Class: http.ServerResponse:

  • Event: 'close'
  • Event: 'finish'
like image 97
Gerardo Roza Avatar answered Oct 10 '22 17:10

Gerardo Roza