Tuesday, 26 February 2019

Express: app.delete(path, callback [, callback ...]): Route delete requests


app.delete(path, callback [, callback ...])
This method route delete requests specific to this path to the provided callback functions.

Example
app.delete('/aboutMe', loggingCallback, authorizationCallback)

index.js
var express = require('express')

var app = express()

loggingCallback = (req, res, next) =>{
 console.log("Logging user information")
 next()
}

authorizationCallback = (req, res) => {
 console.log("User details are deleted")
 res.send("Your details are deleted")
}

app.delete('/aboutMe', loggingCallback, authorizationCallback)

app.get('/', (req, res) => {
 res.send("Hello World")
})

app.listen(3000, () => {console.log("Application started in port 3000")});



Previous                                                 Next                                                 Home

No comments:

Post a Comment