Thursday 28 February 2019

Express: app.METHOD(path, callback [, callback ...]): Route http request to specific method

app.METHOD(path, callback [, callback ...])
Route the requests to the path to given callback functions. Here the METHOD can be one of following.

checkout
copy
delete
get
head
lock
merge
mkactivity
mkcol
move
m-search
notify
options
patch
post
purge
put
report
search
subscribe
trace
unlock
unsubscribe

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

var app = express()

app.get('/', function (req, res) {
  res.send('get request received');
});

app.unlock('/', function (req, res) {
  res.send('unlock request received');
});

app.purge('/', function (req, res) {
  res.send('purge request received');
});

var listener = app.listen(3000, () => {console.log('Application started on port ' + listener.address().port);});


Open any rest client like postman.

Method: UNLOCK



Method : PURGE

Previous                                                 Next                                                 Home

No comments:

Post a Comment