The mount event is fired on a sub-app when it is mounted on a parent app and the parent app is basically passed to the callback function.
Parameter: It is an event named ‘mount’, and callback function is called when this event is called.
Return Value: Since its an event so it doesn’t have any return value.
Installation of express module:
- You can visit the link to Install express module. You can install this package by using this command.
npm install express
- After installing the express module, you can check your express version in command prompt using the command.
npm version express
- After that, you can just create a folder and add a file for example, index.js. To run this file you need to run the following command.
Example 1: Filename: index.js
Steps to run the program:
- The project structure will look like this:
- Make sure you have installed express module using the following command:
npm install express
- Run index.js file using below command:
Admin Mounted Server listening on PORT 3000
Now open your browser and go to http://localhost:3000/admin, now you can see the following output on your screen:
Run index.js file using below command:
Output: Now open your browser and make GET request to http://localhost:3000, now you can see the following output on your console:
Student Mounted Teacher Mounted Server listening on PORT 3000
- Scaffolding an ExpressJS app from scratch
- Routing Path for ExpressJS
- HandleBars Templating in ExpressJS
- HTML | DOM onpause Event
- HTML | DOM onafterprint Event
- HTML | DOM animationend Event
- HTML | DOM touchstart Event
- HTML | DOM onmessage Event
- HTML | DOM ondragover Event
- HTML | DOM animationiteration Event
- HTML | DOM animationstart Event
- HTML | DOM onkeydown Event
- HTML | DOM onmouseout Event
- HTML | DOM onmousedown Event
- HTML | DOM onmouseup Event
- HTML | DOM onmouseenter Event
- HTML | DOM onmouseleave Event
- HTML | DOM onmouseover event
- HTML | DOM onmousemove Event
- HTML | DOM touchend Event
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.