Skip to main content

"app.use"app.use is a function requires middleware. For example:

 app.use('/user/:id', function (req, res, next) {
       console.log('Request Type:', req.method);
        next();
     });

This example shows the middleware function installed in the /user/: id/user/:id path. This function is executed for any type of HTTP request in the /user/: id/user/:id path.

It is similar to the REST Web Server, just use different "/xx"/xx to represent different actions.

"app.use" is a function requires middleware. For example:

 app.use('/user/:id', function (req, res, next) {
       console.log('Request Type:', req.method);
        next();
     });

This example shows the middleware function installed in the /user/: id path. This function is executed for any type of HTTP request in the /user/: id path.

It is similar to the REST Web Server, just use different "/xx" to represent different actions.

app.use is a function requires middleware. For example:

 app.use('/user/:id', function (req, res, next) {
       console.log('Request Type:', req.method);
        next();
     });

This example shows the middleware function installed in the /user/:id path. This function is executed for any type of HTTP request in the /user/:id path.

It is similar to the REST Web Server, just use different /xx to represent different actions.

Source Link

"app.use" is a function requires middleware. For example:

 app.use('/user/:id', function (req, res, next) {
       console.log('Request Type:', req.method);
        next();
     });

This example shows the middleware function installed in the /user/: id path. This function is executed for any type of HTTP request in the /user/: id path.

It is similar to the REST Web Server, just use different "/xx" to represent different actions.